PHP Random Number





ranking Sort Sort   |   date Sort Sort   |   member Sort Sort
Syndication

« Previous 1 2  ...  11 12 13 14 15 16 17 18 19 Next »
11
Date Submitted Mon. Oct. 9th, 2006 4:57 AM
Revision 1
Helper serpentskiss
Tags Password | Random
Comments 1 comments
Creates a random string, usefull for passwords etc.

Use: $password = makeRandomPassword($Length);

If $Length is not specified (ie $password = makeRandomPassword();) then it will default to 8 characters
7
Date Submitted Sun. Oct. 8th, 2006 9:28 PM
Revision 1
Beginner trevis
Tags Array | JavaScript | setTimeout | String
Comments 3 comments
I use this function when passing an array to a function being called from setTimeout();
12
Date Submitted Fri. Oct. 6th, 2006 9:25 AM
Revision 1
Helper BrandonReese
Tags PHP | phpcode
Comments 4 comments
This is a class for generating HTML tables. It's kind of rough, but I thought somebody might want to do something with it.
24
Date Submitted Thu. Oct. 5th, 2006 11:49 AM
Revision 1
Helper Idlemind
Tags mysql | PHP
Comments 2 comments
"Today in the news, MySQL previews..."

As a "preview" of text, this MySQL select will return the first few words out of a text field in a database. It returns entire words (doesn't cut them off in the middle) and follows the last word with an elipse "..."

In the PHP, assign $CharactersToDisplay to a number - the approximate number of characters desired (or you can hard-code it if you want).

For the example, I also use $TheID as the row identity for the record to display.
13
Date Submitted Mon. Oct. 2nd, 2006 1:05 PM
Revision 1
Beginner drench
Tags Array | JavaScript | List | Random | shuffle
Comments 3 comments
It works with Array types. The example is a simple list of numbers, but the array could contain anything; lists of strings, functions, DOM nodes, whatever. Unfortunately, a lot of things that seem like arrays in the DOM aren't really, so you can't shuffle the images on a page with just document.images.shuffle() all by itself.
12
Date Submitted Mon. Oct. 2nd, 2006 11:59 AM
Revision 1
Beginner drench
Tags escape | HTML | JavaScript | String
Comments 0 comments
Similar to Perl's CGI::escapeHTML(), though (because we can!) this adds it as a method to all String objects.
-11
Date Submitted Thu. Sep. 28th, 2006 3:43 PM
Revision 1
Helper ffxfiend
Tags "php" | PHP | phpcode | RegExp
Comments 1 comments
This is a faily simple function to validate a URL being passed into your scripts. It will allow for http, https, and ftp. The beginning www. of a URL is optional as well. It will also validate if you have an IP address in place of the domain name. I'm sure this can be improved upon as this is my first attempt at regular expressions but it has worked good for me so far. Please comment or improve if your able.

Thanks!
7
Date Submitted Wed. Sep. 27th, 2006 10:51 AM
Revision 1
Scripter shachi
Tags function | reverse | String
Comments 3 comments
Turns any string backwards. If you input "Test" it gives out "tseT". Hope it's useful.

The snippet shows how to use it.
7
Date Submitted Tue. Sep. 26th, 2006 1:13 PM
Revision 1
Scripter sehrgut
Tags C | ltrim | Parse | rtrim | String | trim
Comments 1 comments
The modus operandi for this is similar to that taken by PHP's implementation of such functions. It's comparitively memory-intensive, but is much faster than running a whole bunch of tests.

Basically, you set a mask -- an array of 256 null bytes -- and set those that correspond to characters you wish to trim. Then, rather than having to test if a character is in the set of characters to trim(O(n), or linear time on *ws), you just test once (O(1), or unit time) to see if the byte in question is set.

And of course, to trim(), you just wrap trim() around both ltrim() and rtrim().

One point of caution: these functions trim in place, so copy strings before trimming them. (Of course, if you usually want access to both pre- and post-trimmed strings, you could always make these malloc() a new string and return a pointer to it . . . )
12
Date Submitted Sun. Sep. 24th, 2006 5:43 PM
Revision 1
Helper kahotep
Tags HTML | PHP
Comments 6 comments
Generates select boxes, text boxes, check boxes and radio buttons. Via a handful of functions.
« Previous 1 2  ...  11 12 13 14 15 16 17 18 19 Next »