I have an array with this structure:
Array
(
[mysite] => Array
(
[0] => Array
(
[0] => uniqueid
[1] => brand
[2] => horsepower
[3] => topspeed
)
[1] => Array
(
[0] => uniqueid
[1] => brand
[2] => horsepower
[3] => topspeed
)
[2] => Array
(
[0] => uniqueid
[1] => brand
[2] => horsepower
[3] => topspeed
)
)
)
Every car has an “uniqueid” followed by brand, horsepower, etc.
If I want to get the information for a random car, I do it like this:
$rkey = array_rand($sites['mysite'], 1); // get a random key
$car_info = $myarray['mysite'][$rkey];
Do you have any ideas on how to get information by using a certain “uniqueid”
$car_info = "get the information of a car with a certain uniqueid";
Ty!
try,
Pass unique id inside the for loop you will get the desird result
It may help you,
print_r($result );
output:
Array ( [0] => uniqueid2 [1] => brand [2] => horsepower [3] => topspeed )