Showing posts with label in_array php. Show all posts
Showing posts with label in_array php. Show all posts
in_array :php find in array
Posted by Raj
in_array :php find in array
PHP in_array is used to check if a value exists in an array
Syntax:
bool in_array($var,$arr)
Returns TRUE if $var exists in an array, FALSE otherwise.
Example:php find in array
<?php
$arr1 = array('A','B');
if(in_array('A',$arr1))
echo '`A` exists in an array'
else
echo 'Not Found';
?>
Output :
Array.
PHP in_array is used to check if a value exists in an array
Syntax:
bool in_array($var,$arr)
Returns TRUE if $var exists in an array, FALSE otherwise.
Example:php find in array
<?php
$arr1 = array('A','B');
if(in_array('A',$arr1))
echo '`A` exists in an array'
else
echo 'Not Found';
?>
Output :
Array.