Fri May 29 2020
Array Search
PHP Scripting888 views
File Name: array-search.php
<?php
$booklist = array("Java" => 55.25, "C++" => 12.55, "C" => 20.19, "Python" => 100.50, "PHP" => 62.12, "HTML" => 50.00, "CSS" => 35.20);
/* Search array using array_search() */
$bookname = array_search(35.20, $booklist);
if($bookname)
echo "Price of ".$bookname." is $35.20";
else
echo "No book found at $35.20";
?>
/* Output */
Price of CSS is $35.20
Reference:
Author:Geekboots