Thank you very much guys, but it seams I was wrong to use this function in the first place.
It turns out I need to switch the places of the key and the value and look for the value while I have the key name.
I reversed the array so now the value and it's key switched places:
Code: Select all
<?php
$a=array("Dog_2_2"=>'234');
$x = ("2");
$y = ("2");
$dog = "Dog_" . $x . "_" . $y ;
...
now I need to use the key $dog, which is a string formed from post data, and look for the respective value.
I tried the KEY function, as in the previous post but it uses ARRAY_SEARCH and therefore searches by value and not by key.
I need to print 234 from this array.
I managed to print it with:
Code: Select all
$arr = array( "tile_1_2_left" => "352" );
foreach ($arr as $key => $value) { print $value; }
But it's not helping because I never specified a key name.