Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Find a Specific Value in an Array
How To Find a Specific Value in an Array? - PHP Script Tips - PHP Built-in Functions for Arrays
✍: 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 arrary_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:
2007-04-20, 5183👍, 0💬
Popular Posts:
What Is the "@SuiteClasses" Annotation? "@SuiteClasses" is a class annotation defined in JUnit 4.4 i...
.NET INTERVIEW QUESTIONS - What is Multi-tasking ? It’s a feature of modern operating systems with w...
The object that contains all the properties and methods for every ASP.NET page, that is built is .. ...
How To Increment Dates by 1? - MySQL FAQs - Introduction to SQL Date and Time Handling If you have a...
What are the core functionalities in XML .NET framework? Can you explain in detail those functionali...