Main menu

Training

16 Jan

15 minute php - Day 2

Published by Mark W. Breneman

Let's dive in a little deeper. I find it handy to know not only how to use the tools, but also the oddities and pit falls. Today we are going to take a deeper look at php index arrays.

 

How do you update a value in an array?

$foo = array('red',"blue","green");

$foo[0] = 'silver'; 

$foo[1] = 'white'; 

$foo[2] = 'purple'; 

 

15 Jan

15 minute php - Day 1

Published by Mark W. Breneman

Indexed Arrays

Indexed arrays in PHP are really simple. They are arrays that are referenced numerically by position starting with 0 as first position.

 

Create an indexed array:

$foo = array('red',"blue","green");

 

Item at position 1 can be addressed  by:

$foo[0]  (echo $foo[0];)

 

Item at position 2 can be addressed  by:

$foo[1]