Thursday, October 16, 2008

array base technique

To make easy using array, be better if we comprehend Array Base Technique must be first. Create Array Array in PHP grouped to become two type, indexed and associative. Array Indexed is array who’s the key like in the form of integer, normally started from 0. Array associative used string as key. You Can Create array with two models. Number one uses language construction array() and square bracket sintax.
$arr1 = array(‘a’,’b’,’c’); print_r($arr1); $arr2[] = ‘a’; $arr2[] = ‘b’; $arr2[] = ‘c’; Print_r($arr2);
Create array associative you must do that with same way. But in here you must specified of base key.
$arr3 = array(‘a’ => ‘A’, ‘b’ => ‘B’, ‘c’ => ‘C’); print_r($arr3); $arr4[‘a’] = ‘A’; $arr4[‘b’] = ‘B’; $arr4[‘c’] = ‘C’; print_r($arr4);

0 comments:

Post a Comment