Week 5 - Supplementary Lectures - 6 (Arrays and Some String Functions)
Week 5 - Supplementary Lectures - 6 (Arrays and Some String Functions)
$empty_array = [];
Example:
keep track of elements by names rather than by
$html['title'] = 'PHP Associative Arrays';
numbers.
$html['description'] = 'Learn how to use
• Creating associative arrays: To create an associative arrays in PHP';
associative array, you use the array() construct:
<?php print_r($html);
Output:
$html = array(); Array
(
[title] => PHP Associative Arrays
[description] => Learn how to use associative arrays in PHP
)
echo $html['title'];
APPDET | APPLICATION
COMPROG2 | COMPUTERDEV’T & EMERGING
PROGRAMMING TECH. | |Prof.
2 (Elective) Prof.ROEL
ROELC.C.TRABALLO
TRABALLO