Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想获取我正在寻找使用的元素的索引,in_array("Tuesday", $day)并从与此相同位置的另一个数组中获取元素。我有 2 个数组:$day和$action. 我需要一些帮助,我被困住了。
in_array("Tuesday", $day)
$day
$action
in_array 不会返回任何索引,它只是一个布尔值,array_search 执行相同的工作并返回键,例如:
$key = array_search("Tuesday", $day); if($key !== false) // do stuff (and you can of course do $action[$key]