PHP Scripting

Array Search

Learn PHP example of search data from array

5/29/2020
0 views
array-search.phpPHP
<?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
PHPsearch arraysearch data from array

Loading comments...

Related Examples

Deliver breaking news, insightful commentary, and exclusive reports.

Targeting readers who rely on our platform to stay ahead of the curve.

Contact Us: benzingaheadlines@gmail.com