开发者

inarray function won't work with session variable that is set to array

开发者 https://www.devze.com 2023-03-25 02:09 出处:网络
Everytime the script that contains the inarray function executes, the element disappears and the开发者_如何学Go ones that comes after it. I believe it means that it\'s not working. I set the session v

Everytime the script that contains the inarray function executes, the element disappears and the开发者_如何学Go ones that comes after it. I believe it means that it's not working. I set the session variable to an array just like setting a regular variable to an array.

$items = array("A", "B", "C");
$_SESSION["item"] = $items;

if(inarray("A", $_SESSION["item"])) { echo "An item!"; }

This doesn't work. I can't get the echo to work. On top of that, the elements that comes after it disappears indicating that it doesn't work?


if you mean standard in_array function then there is the mistake in your code

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号