Tools, FAQ, Tutorials:
Finding a Given Value in an Array in PHP
How To Find a Specific Value in an Array in PHP?
✍: FYIcenter.com
There are two functions can be used to test if a value is defined in an array or not:
Here is a PHP script on how to use array_search():
<?php
$array = array("Perl", "PHP", "Java", "PHP");
print("Search 1: ".array_search("PHP",$array)."\n");
print("Search 2: ".array_search("Perl",$array)."\n");
print("Search 3: ".array_search("C#",$array)."\n");
print("\n");
?>
This script will print:
Search 1: 1 Search 2: 0 Search 3:
⇒ Retrieving All Keys from an Array in PHP
⇐ Verifying If a Key Exists in an Array in PHP
2017-01-21, ∼2328🔥, 0💬
Popular Posts:
What Happens If One Row Has Missing Columns? What happens if one row has missing columns? Most brows...
How to create a "Sign-up or Sign-in" user flow policy in my Azure AD B2C directory? If you want to b...
What is EPUB 3.0 Metadata "dc:publisher" and "dc:rights" elements? EPUB 3.0 Metadata "dc:publisher" ...
Where to find tutorials on RSS specifications? I want to learn it to describe my API services. Here ...
How to reinstall npm with a node version manager? I am getting permission errors with the current ve...