: This article mainly introduces how to create a value array in php. if you are interested in the PHP Tutorial, refer to it. In this program, we can see how to create an array value and use the count function to obtain the length of the array.
And how to traverse the array. in this program, we can also see some basic syntax in php.
$ Cars = array ("Volvo", "BMW", "tOyota"); // you can create an array that automatically allocates id values.
Echo "I like ". $ cars [0]. ",". $ cars [1]. ",". $ cars [2]. ". "; // output array, which is output to the screen
Print ("The length of the array is:"); // print the length of the array
Echo count ($ cars); // use a function to calculate the length of an array
$ Carss = array ("Volvo", "BMW", "Toyota ");//
$ Number = count ($ carss); // use a function to calculate the length of an array, return a data value, and assign the value to a variable.
For ($ x = 0; $ x <$ number; $ x ++)
{
Echo $ cars [$ x]; // output array
Echo"
";
}
?>
The above describes how to create a value array in php, including some content. I hope to help anyone who is interested in the PHP Tutorial.