PHP Lesson 11 - Arrays in PHP

preview_player
Показать описание
In this lesson I look at creating arrays within the PHP code. I demonstrate how to create them using two different approaches. The index of an array is the number position of the elements. The elements of an array are the values that are stored in the array.

Рекомендации по теме
Комментарии
Автор

You actually did not need to include var $state1 and $state2 the array will still work when you echo $states[0];

Optimalgeek
Автор

First you declared and initialized $States[2] = Alabama and then $States[2] = "Arizona" , so it means old $States[2] value was replaced newest value i.e with Arizona, so output will be Arizona. its very basic

junaidtanoli
Автор

$States[] = "";
$States[] = "Alaska";
$States[2] = "Alabama";
$States[] = "Arkansas";
$States[2] = "Arizona";

echo $States[2];
How does the programm choose the 2 no? In my case it was Arizona

oscarduell
visit shbcf.ru