Php in_array function with example
The in_array() function is an predefined function in PHP. The in_array() function is used to check whether a given value exists in an array or not. If the value exist in the array its return true otherwise return false.
<?php
$roll_number = array(1,2,3,4,5 );
if (in_array("2", $roll_number))
{
echo "found";
}
else
{
echo "not found";
}
?>
Warning: Undefined variable $article_id in
/var/www/html/st/includes/get_article.php on line
9
Fatal error: Uncaught mysqli_sql_exception: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 6 in /var/www/html/st/includes/get_article.php:9
Stack trace:
#0 /var/www/html/st/includes/get_article.php(9): mysqli_query()
#1 /var/www/html/st/php/php-in-array.php(114): include('...')
#2 {main}
thrown in
/var/www/html/st/includes/get_article.php on line
9