06b2_Loops

the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire
the quackquack ed weire

Eternal Loop

OK,Can I think of it this way: never have the second variable be a number less than the LH one.

Adding Strings Together and Concatenation

Two ways to join strings: first, using extrapolative string; second, using concatenation with literal-string break:

cats are never flat.
cats are never flat.

Echoing Arrays Using Loops 1.

We start with an indexed array. For ejemplo,

$myArray = array('cat' , 'dog' , 'bear' , 'peach' , 'twig');

Next, with our "For' conditional composed of 3 statements:

for (sets value ; compares value ; increments [to shut off])

{

Next, the action(s) to loop over and over;

}

cat
dog
bear
peach
twig

Echoing Arrays Using Loops 2.

dog
bee
orchid
gnat
buddha

Counting an Array

I have to take the logic of what follows on faith; the bit about subtracting 1 from the 'count' function makes little sense to me and when stuff doesn't make sense, I don't remember well. Why is the array indexed to 0 in the first place, if this has to be done? "Whatever!" Just memorize it by rote, yes? "It will latyr be revealed!"

dogbutt
beebutt
orchidbutt
gnatbutt
buddhabutt
grundlebutt
wheezebutt

Do this exercise again.

fruit
veg
meat
carbo's
fibre

Counting Arrays using Foreach Command

0 equals: fruit
1 equals: veg
2 equals: meat
3 equals: carbo's
4 equals: fibre

Again: Counting A Keyed Array Using 'Foreach' Command

Time out: ALL arrays are 'keyed' apparently. It's just that 'indexed' means the key is by default integers (starting with 0), and 'associative' means each value is paired with a preceding name that's nat an integer.

dog equals fruit
dogg equals veg
doggg equals meat
dogggg equals carbo's
doggggg equals fibre

Foreach Command again: Associative Array

note how repeated keys are not counted again. also note that 'foreach' key and value elements seem to be nameable as anything. though it makes it clearer for later is they're just called names like '$key' and '$value'.

vop equals bom
vog equals wot
vot equals vot

Foreach Command again: Associative Array

vop equals vop
vog equals wot
vot equals vot
vom equals vom
von equals bom

Adding values to the Array from outside of It (right wording?)--Indexed Array

0 equals voob
1 equals vood
2 equals voof
3 equals voog
4 equals vooj
5 equals kiwi

Adding values from outside of the Array (right wording?)--Associative Array

voob equals vom
vood equals vom
voof equals vom
voog equals vom
vooj equals von
vook equals kiwi

one more time: counting out the assoc. array and adding more stuff from outside it

aof boggles tur mindy: oar
bof boggles tur mindy: ogg
doof boggles tur mindy: bogg
duuf's boggles tur mindy: bawg
bahkbahk boggles tur mindy: von
furder boggles tur mindy: that f'in' kiwi again