| px | top | add code | search | signup | login | help |
<?php
//you enter a string a position and a delimiter
//this return the position of the char next the delemiter
//and the piece of the string
//$string="blahblah|hello|cool"
// for($i=0;$poi<strlen($string);$i++)
// {
// $pc=NextPiece($string,$poi,"|");
// $array[$i]=$pc;
// }
function NextPiece($string,&$poi,$delimiter)
{
$pos=strpos($string,$delimiter,$poi);
//echo "<br>".$poi." = ".$pos;
if($pos===false)
{
$pc=substr($string,$poi);
$poi=strlen($string);
return $pc;
}
else
{
$pc=substr($string,$poi,$pos-$poi);
//echo "<br>".$string."<br>".$poi."<br>".$pos."<br>".$pc;
$poi+=strlen ($pc)+1;
return $pc;
}
}
//see you
//kiss
// julie ;-)
?>
Comments or questions?
PX is running PHP 5.2.11
Thanks to Miranda Productions for hosting and bandwidth.
Use of any code from PX is at your own risk.