3w PHP Your Source for PHP Source Code

14Oct/102

Checking if string exist in array values

In  this sample, we create array with names for a group.
Then we check to see if a specific name is in the group...

Here is the sample.

<?php
// Array of names in group
$array = array('Sam' , 'Louis' , 'Samentha' , 'Joe');
 
if (in_array('Joe',$array))
{
	echo 'Joe is in group...';
}
?>

Thank you and please, do not hesitate to comment.

Comments (2) Trackbacks (0)
  1. hello


Leave a comment

(required)

No trackbacks yet.