Array Search

<?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

Comments (0)

  • To add your comment please or

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.

Got It!