Sunday, 25 June 2017

71.in array

eg.1
if(in_array($data['user_id'],$user_ids)){

}
eg.2
$array = array('kitchen', 'bedroom', 'living_room', 'dining_room');

if (in_array('kitchen', $array)) {
    echo 'this array contains kitchen';
}

eg3
<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland");

if (in_array("Glenn", $people))
  {
  echo "Match found";
  }
else
  {
  echo "Match not found";
  }
?>

No comments:

Post a Comment