david212 Posted February 22, 2009 Share Posted February 22, 2009 hello! i have problems with associative arrays. In "value" parameter there are "132" and "12344", (the first time the number"3" appears in "132 " and the second time it appears in "12344"). I need to extract it and count how many times this number is displayed in the middle of this given words? I've coded this one <?php $myArr=array("kkey"=>"132","2kkey"=>"12344"); $val=array_values($myArr); $s=sizeof($val); for($i=0;$i<$s;$i++){ $s2=strlen($val[$i]); if($s2%2==1){ $a=$val[$i][($s2-1)/2]." "; } } ?> but i don't know how to display the number, i've used $var++ but it displays all "value" middle letters. and i need only "3" value. Thanx Link to comment https://forums.phpfreaks.com/topic/146349-need-help/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.