|
explicit location
|
<?php |
|
implicit location
|
<?php |
<?php
$printer['R&B PRINTERS']= "Laserjet 2002";
$printer['Jackson Printers'] = "J2001Laserjet";
print_r($printer);
//result
array (
'R&B PRINTERS' => "Laserjet 2002",
'Jackson Printers' => "J2001Laserjet",
)
?>
<?php
$products = array(
'pens' => array(
'ball' => "Ball Point",
'hilite' => "Highlighters",
'marker' => "Markers"),
'misc' => array(
'tape' => "Sticky Tape",
'glue' => "Adhesives",
'clips' => "Paperclips"
)
);
`<?php {{nl}}$p1 = array("China", "Russia", "Austria", "Turkey"); {{nl}}$p2 = array {{nl}} ({{nl}} 'china' => "Beijing", {{nl}} 'Russia' => "Moscow" ,{{nl}} 'Austria' => "Vienna", {{nl}} 'Turkey' => "Ankara" {{nl}} );
<?php
$paper = array("Copier", "Inkjet", "Laser", "Photo");
$j = 0;
foreach($paper as $item)
{
echo "$j: $item<br>";
++$j;
}
?>
|
Functions
|
|
is_array()
|
echo (is_array($products)) ? "Is an array" : "Is not an array"; |
|
count()
|
echo count($products); |
|
sort()
|
sort($products); |
|
shuffle()
|
shuffle($cards); |
|
explode()
|
<?php |
|
extract()
|
extract($_GET); |
<?php
$planet = "Gallifrey";
$system = "Gridlock";
$constellation = "Kasterborous";
$contact = compact 'planet', 'system', 'constellation');
No comments yet.
Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.