PHP Array Function Example
Hello Friends,
Now let's see example of how to use array in php function. This is a short guide on php if array function. We will use array function in php. PHP provides various array functions to access and manipulate the elements of array. PHP array() function creates and returns an array. It allows you to create indexed, associative and multidimensional arrays.
Here i will give you example of how you can check array function in php file.
Syntax 1 for indexed arrays:
array(value1, value2, value3, etc.)
Syntax 2 for associative arrays:
array(key=>value,key=>value,key=>value,etc.)
Example
<!DOCTYPE html>
<html>
<head>
<title>Array Function in PHP - NiceSnippets.com?</title>
</head>
<body>
$cars=array("Volvo","BMW","Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
</body>
</html>
Output:
I like Volvo, BMW and Toyota.
It will help you....
- How To Use Php Conditional Statement Example
- How to Check if String Contains Regex in PHP?
- PHP Array_column() Function Example
- PHP Generate List of Random Numbers Between 0 and 100 Example
- How to User Login with Facebook in PHP?
- How to Explode Every Character into Array Using PHP Example?
- PHP Form Validation Tutorial
- PHP Convert XML to JSON Example