Php Arrays

[codesyntax lang=”php” container=”div”]

<?php
// File Description: PHP - Array Tutorial
// First Method To Create Numeric Arrays
 
$arrayExample[0] = "Robert";
$arrayExample[1] = "<a href='http://www.thephpbasics.com'>ThePHPBasics.com</a>";
$arrayExample[2] = "John";
$arrayExample[3] = 9;
 
//Robert teaches basic PHP tutorials at ThePHPBasics.com
 
echo "$arrayExample[0] teaches basic PHP tutorials at $arrayExample[1]";
 
//John is 9 years old
 
echo "<br>";
echo "$arrayExample[2] is $arrayExample[3] years old";
 
// Second Method To Create Numeric Arrays
 
$arrayNum = array("76", "50", "45", "30", "23", "3938");
 
echo "<br>The number: $arrayNum[1]";
 
?>

[/codesyntax]

 .

Lasă un răspuns

Adresa ta de email nu va fi publicată. Câmpurile obligatorii sunt marcate cu *