ledavid_
10-11-2011, 06:37 AM
That function is basic. I even created.
function readc($char,$phrase){
$max = strlen($phrase); // Read total Phrase letters;
$letter = strtolower($phrase); // Set phrase to tiny
for($i=0;$i < $max;$i++){
if($letter[$i] == $char){
$pos .= $i. " ";
$count++;
}
}
return $count; // $count = how much times the char was showed; $pos = what position it is;
}
How to use:
<?php
$words = "This is a example.";
echo readc("t",$words); // This result 1;
?>
function readc($char,$phrase){
$max = strlen($phrase); // Read total Phrase letters;
$letter = strtolower($phrase); // Set phrase to tiny
for($i=0;$i < $max;$i++){
if($letter[$i] == $char){
$pos .= $i. " ";
$count++;
}
}
return $count; // $count = how much times the char was showed; $pos = what position it is;
}
How to use:
<?php
$words = "This is a example.";
echo readc("t",$words); // This result 1;
?>