Function array_search works only with digits and not with variables eg.
$key = array_search(2345632, $rozm);
But I need it to get the number from the variable like
$key = array_search($ro, $rozm);
But it doesn't work.
Function array_search works only with digits and not with variables eg.
$key = array_search(2345632, $rozm);
But I need it to get the number from the variable like
$key = array_search($ro, $rozm);
But it doesn't work.
It actually works.. see here
<?php
$rozm=[23,54,55];
$ro=54;
echo $key = array_search($ro, $rozm); //"prints" 1
Your $ro variable must be a string.. so just cast it like this
$key = array_search(intval($ro), $rozm);
1? array_search() doesn't care about the type of the argument unless you run it with strict parameter set to true (An exception - If needle is a string, the comparison is done in a case-sensitive manner. - but that's not the case here) :)