Archive for January, 2010
set_time_limit()
Sets the maximum number of seconds a script can run from that point. Fatal error if this time is exceeded. Default is max_execution_time if it is set in the ini file, otherwise 30 seconds.
Trivia
The acronym PHP originally stood for what?
[answer: Personal Home Page]
parse_url()
Returns an array of the given url’s components. Host, path, query string, and other info.
wordwrap()
Similar to setting the right margin in a word processor, this function will insert a linefeed character (or characters of your choice) after a certain number of characters. Default is 75 characters wide.
compact()
Like the opposite of extract() this function creates an array from the given variables using the variable names as the keys.
extract()
Creates variables (in the current scope) from an array. The keys become the variable names. Handle collisions and/or invalid keys with the second parameter, and optionally add a prefix to the new variable names.
array_rand()
For obtaining one or more random entries from an array. Returns the key (or an array of keys) and does not affect the original array. The second parameter (optional) determines how many keys will be selected at random.
Short Tags
You open and close blocks of PHP code with respectfully. With short tags, you can open a PHP block with but there are negatives. Short tags may be turned off in some environments. This and other conflicts (printing an xml declaration) may cause your scripts to stop working. Using the full
shuffle()
Puts an array in random order removing all existing keys. The array will now have numbered keys starting at zero. Does not create a new array; alters the original array.
$_REQUEST
The $_REQUEST superglobal contains the contents of $_GET, $_POST, and $_COOKIE (in that order - overwritting conflicting keys). The order and even presence of these can be configured with the variables_order directive.
