I want to get the index of an element which I'm looking for using in_array("Tuesday", $day)
and get the element from another array on the same position as this one. I have 2 arrays: $day
and $action
. I need some help with this, I'm stuck.
the in_array won't return you any index, it's just a boolean, array_search does the same job and returns the key, ex:
$key = array_search("Tuesday", $day);
if($key !== false)
// do stuff (and you can of course do $action[$key]
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.