Folders renumbered

Folders renumbered
This commit is contained in:
RobinNixon
2020-12-10 13:35:00 +00:00
parent d0519f0697
commit e311e3750d
153 changed files with 2 additions and 0 deletions
+8
View File
@@ -0,0 +1,8 @@
<?php
$paper[] = "Copier";
$paper[] = "Inkjet";
$paper[] = "Laser";
$paper[] = "Photo";
print_r($paper);
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
$paper[0] = "Copier";
$paper[1] = "Inkjet";
$paper[2] = "Laser";
$paper[3] = "Photo";
print_r($paper);
?>
+9
View File
@@ -0,0 +1,9 @@
<?php
$paper[] = "Copier";
$paper[] = "Inkjet";
$paper[] = "Laser";
$paper[] = "Photo";
for ($j = 0 ; $j < 4 ; ++$j)
echo "$j: $paper[$j]<br>";
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
$paper['copier'] = "Copier & Multipurpose";
$paper['inkjet'] = "Inkjet Printer";
$paper['laser'] = "Laser Printer";
$paper['photo'] = "Photographic Paper";
echo $paper['laser'];
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$p1 = array("Copier", "Inkjet", "Laser", "Photo");
echo "p1 element: " . $p1[2] . "<br>";
$p2 = array('copier' => "Copier & Multipurpose",
'inkjet' => "Inkjet Printer",
'laser' => "Laser Printer",
'photo' => "Photographic Paper");
echo "p2 element: " . $p2['inkjet'] . "<br>";
?>
+10
View File
@@ -0,0 +1,10 @@
<?php
$paper = array("Copier", "Inkjet", "Laser", "Photo");
$j = 0;
foreach($paper as $item)
{
echo "$j: $item<br>";
++$j;
}
?>
+9
View File
@@ -0,0 +1,9 @@
<?php
$paper = array('copier' => "Copier & Multipurpose",
'inkjet' => "Inkjet Printer",
'laser' => "Laser Printer",
'photo' => "Photographic Paper");
foreach($paper as $item => $description)
echo "$item: $description<br>";
?>
+18
View File
@@ -0,0 +1,18 @@
<?php
$paper = array('copier' => "Copier & Multipurpose",
'inkjet' => "Inkjet Printer",
'laser' => "Laser Printer",
'photo' => "Photographic Paper");
while (list($item, $description) = myEach($paper))
echo "$item: $description<br>";
function myEach(&$array) // Replacement for the deprecated each function
{
$key = key($array);
$result = ($key === null) ? false :
[$key, current($array), 'key', 'value' => current($array)];
next($array);
return $result;
}
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
list($a, $b) = array('Alice', 'Bob');
echo "a=$a b=$b";
?>
+32
View File
@@ -0,0 +1,32 @@
<?php
$products = array(
'paper' => array(
'copier' => "Copier & Multipurpose",
'inkjet' => "Inkjet Printer",
'laser' => "Laser Printer",
'photo' => "Photographic Paper"),
'pens' => array(
'ball' => "Ball Point",
'hilite' => "Highlighters",
'marker' => "Markers"),
'misc' => array(
'tape' => "Sticky Tape",
'glue' => "Adhesives",
'clips' => "Paperclips"
)
);
echo "<pre>";
foreach($products as $section => $items)
foreach($items as $key => $value)
echo "$section:\t$key\t($value)<br>";
echo "</pre>";
?>
+28
View File
@@ -0,0 +1,28 @@
<?php
// This example is corrected from the one in the book,
// which had two extra blank rows in the center.
$chessboard = array(
array('r', 'n', 'b', 'q', 'k', 'b', 'n', 'r'),
array('p', 'p', 'p', 'p', 'p', 'p', 'p', 'p'),
array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '),
array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '),
array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '),
array(' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '),
array('P', 'P', 'P', 'P', 'P', 'P', 'P', 'P'),
array('R', 'N', 'B', 'Q', 'K', 'B', 'N', 'R')
);
echo "<pre>";
foreach($chessboard as $row)
{
foreach ($row as $piece)
echo "$piece ";
echo "<br>";
}
echo "</pre>";
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
$temp = explode(' ', "This is a sentence with seven words");
print_r($temp);
?>
+4
View File
@@ -0,0 +1,4 @@
<?php
$temp = explode('***', "A***sentence***with***asterisks");
print_r($temp);
?>
+12
View File
@@ -0,0 +1,12 @@
<?php
$fname = "Doctor";
$sname = "Who";
$planet = "Gallifrey";
$system = "Gridlock";
$constellation = "Kasterborous";
$contact = compact('fname', 'sname', 'planet', 'system', 'constellation');
print_r($contact);
?>
+8
View File
@@ -0,0 +1,8 @@
<?php
$j = 23;
$temp = "Hello";
$address = "1 Old Street";
$age = 61;
print_r(compact(explode(' ', 'j temp address age')));
?>