I want to check values are present in the array and print one random value, but it is giving undefined index error
Here is the code
<?php
$agents = array(9986344xxx,9663275yyy);
function agent(){
global $agents;
if (in_array(9986344xxx,$agents) || in_array(9663275yyy, $agents)) {
$random = array_rand($agents);
echo $agents[$random[0]];
}
else{
echo "notfound";
}
}
agent();