php - Search for variable content in array list -



php - Search for variable content in array list -

i have 4 strings numbers this:

$num1 = 0; $num2 = 3; $num3 = 3; $num4 = 0;

then higher number:

$higher = max($num1, $num2, $num3, $num4);

so "$higher = 3"

then create array owner of number , number this:

$arr = array("user1" => $num1, "user2" => $num2, "user3" => $num3, "user4" => $num4);

now issue:

i search array $arr value $higher (3 in case) , "user2" , "user3" return.

how can that?

thanks lot.

you can utilize array_search search array value , associated key.

$key = array_search($higher,$arr);

php

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -