php find number of occurances (number of times)

Posted by Val on Stack Overflow See other posts from Stack Overflow or by Val
Published on 2010-03-20T13:57:27Z Indexed on 2010/03/20 14:01 UTC
Read the original article Hit count: 358

Filed under:
|

can someone help with this?

I need the following function to do this...

$x = 'AAAABAA';
$x2 = 'ABBBAA';

function foo($str){
   //do something here....
   return $str;
}

$x3 = foo($x); //output: A4B1A2
$x4 = foo($x2);//output: A1B3A2

© Stack Overflow or respective owner

Related posts about php

Related posts about number