Numeric Arrays
A numeric array stores each element with a numeric ID key.
There are different ways to create a numeric array.
Example 1
In this example the ID key is automatically assigned: PDF by Hans Home Collection
Example 2
In this example we assign the ID key manually:
The ID keys can be used in a script:
The code above will output:
Quagmire and Joe are Peter's neighbors
A numeric array stores each element with a numeric ID key.
There are different ways to create a numeric array.
Example 1
In this example the ID key is automatically assigned: PDF by Hans Home Collection
$names = array("Peter","Quagmire","Joe"); |
Example 2
In this example we assign the ID key manually:
$names[0] = "Peter"; $names[1] = "Quagmire"; $names[2] = "Joe"; |
The ID keys can be used in a script:
<?php $names[0] = "Peter"; $names[1] = "Quagmire"; $names[2] = "Joe"; echo $names[1] . " and " . $names[2] . " are ". $names[0] . "'s neighbors"; ?> |
Quagmire and Joe are Peter's neighbors
0 comments:
Post a Comment