note 68225 deleted from function.strlen by nlopess
| From: | nlopess@php.net | Date: | Thu, 05 Apr 2007 19:39:26 +0000 |
| Subject: | note 68225 deleted from function.strlen by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-125120@lists.php.net to get a copy of this message | ||
Note Submitter: abraao dot zaidan at uol dot com dot br
----
I make a function like strlen():
<?php
function contaci($string, $inc)
{
$item = substr($string, $inc, 1);
if($item != "")
{
$inc++;
$volta = contaci($string, $inc);
return $volta;
}
else
{
return $inc;
}
}
function conta($string)
{
$volta = contaci($string, 0);
return $volta;
}
$string = "abcdef";
$conta = conta($string); // ==> 6
$string = " ab cd ";
$conta = conta($string); // ==> 7
?>