<?php
function array_list($array)
{
printf("
(%s)
\n", implode(', ', $array));}
$arr1 = range(5,11); #integer start/end
array_list($arr1);
$arr2 = range(0, -5);
array_list($arr2);
$arr3 = range(3, 15, 3);
array_list($arr3);
array_List(range(20,0,-5));
array_List(range(2.4, 3.1, .1));
array_List(range('a', 'f'));
?>
Here is another tutorial:
$languages = array('German', 'French', 'Spanish');
printf("
Languages: %s .
\n", implode(', ', $languages));Here is another tutorial:
$countries_languages = array('Germany' => 'German', 'France' => 'French', 'Spain' => 'Spanish');
echo "Array values: ";
printf("
Languages: %s.
\n",implode(',', array_values($countries_languages)) );echo "Array keys: ";
printf("
Countries: %s.
\n",implode(',', array_keys($countries_languages)) );Here is yet another tutorial:
$customers = array(array('first' => 'Bill', 'last' =>'Jones', 'age' => 24, 'state' => 'CA'),
array('first' => 'Mary', 'last' => 'Smith', 'age' => 32, 'state' => 'OH'),
array('first' => 'Joyce', 'last' => 'Johnson', 'age' => 21, 'state' => 'TX'),
);
printf("print_r():
%s", print_r($customers, TRUE));
printf("var_export():
%s", var_export($customers, TRUE));
print 'var_dump():
';';
var_dump($customers);
print '
No comments:
Post a Comment