There are two basic output statements in PHP, Echo and print
What's the difference between these two things?
echo can output one or more characters at a time:
Echo "This is a", "string,", "used", "multiple", "parameter." ";
Like this, there is no problem with the output.
The result of the output is: This is a string that uses more than one parameter
Then echo's output is not wrapped, and if you need to wrap it, you can add it later <br>
Echo "This is a", "string,", "used", "multiple", "parameter." <br> ";
You can also add a variable output to the middle of a string.
$x=5; Echo $x, "a", "parameter." <br> ";
is still more convenient.
Can also be like this, but $x must add a space behind, or will error
$x=5; Echo "This is a", "string,", "used", "$x ", "parameter." <br> ";
Array
$cars=array("Volvo", "BMW", "Toyota");
You can create an array like this, using the count () function to return the number of elements in the array
Echo Count ($cars);
You can use the following methods to facilitate an array:
$dog=array("xxx", "yyyy", 5,3.23, "Xxd"); $lang=count($dog); for ($x= 0; $x<$lang; $x+ +) {echo$dog[$x], "<br>";}
Good trouble, it's not as simple as python.
PHP Full Stack Development (V): PHP Learning (2. Echo and print output, array)