Jump to content

Need help!


david212

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.