Parse a string into separate words (array output).
function parser($str, $char = ' ')
{
$str = trim($str);
$str = $str . $char;
$len = strlen($str);
$words = array();
$w = '';
$c = 0;
for ($i = 0; $i < $len; $i++)
if ($str[$i] != $char)
$w = $w . $str[$i];
else
if (($w != $char) and ($w != '')) {
$words[$c] = $w;
$c++;
$w = '';
}
return $words;
}
$x = parser('hello world!');
print_r($x);Tags
No tag here. Recommended pages
SQL escape string function...Escapes special characters in a string for use in an SQL statement. howewer it check get_magic_quotes_gpc function is enable or no. if true , it strips string from slashes and escaped string from spec...
Resize image function...Resize image function for jpg format. $mood between max and min. if you choose max, this mean max size of image is $ta otherwise min size of image is $ta.
function makeTheThumb( $ppath, $ta, $mood )
...
File size calculator...File size calculator function return file size format into kb, mb or gb.
function file_size($size, $out = 'kb', $precision = 2)
{
switch ($out) {
case 'kb':
return round($...
Random string generator...Random string generator. Optionally, you can give it a desired string length.
function rnd_string($len = 24)
{
$str = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
$str...