Finding Items in an Array or not with PHP
April 23rd, 2008 — adminThe problem: we have an array of items in PHP and we want to find out if a specific item is in the array. In code we can define the array as:
Read the rest of this entry »
The problem: we have an array of items in PHP and we want to find out if a specific item is in the array. In code we can define the array as:
Read the rest of this entry »
ucfirst — Make a string’s first character uppercase
example:
$coo= ‘clay desiccant!’;
$coo= ucfirst($desiccant); // Clay desiccant!
$bar = ‘CLAY DESICCANT!’;
$bar = ucfirst($bar); // CLAY DESICCANT!
$bar = ucfirst(strtolower($bar)); // Clay desiccant!
$dirname=”E:/zhanzhongjie/chengbiao-com/chengbiao-com”;
$dir_handle=opendir($dirname);
while($file=readdir($dir_handle)) Read the rest of this entry »
/*random function
$length: length of needed number
*/
function random($length) {
$hash = ”;
$chars = ‘0123456789′;
$max = strlen($chars) - 1;
mt_srand((double)microtime() * 1000000);
for($i = 0; $i < $length; $i++) {
$hash .= $chars[mt_rand(0, $max)];
} Read the rest of this entry »
— Renames a file or directory
Description
bool rename ( string $oldname , string $newname [, resource $context ] )
Attempts to rename oldname to newname . Read the rest of this entry »
Description
int fwrite ( resource $handle , string $string [, int $length ] )
fwrite() writes the contents of string to the file stream pointed to by handle . Read the rest of this entry »
Description
string chr ( int $ascii )
Returns a one-character string containing the character specified by ascii . Read the rest of this entry »