Kevin Falcone on Tue, 29 Feb 2000 00:06:37 -0500 (EST)


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

php arrays


For those of us still curious about php arrays, I did the following
experiment.

Take the following code

    $fruits = array();
    $fruits['apple'] = 'red';
    $fruits['banana'] = 'yellow';
    
    echo "\$fruits is " . sizeof($fruits) . " elements long<br />";

    for ($i = 0; $i < sizeof($fruits); $i++) {
        echo "element $i of \$fruits is $fruits[$i] <br />";
    }    

    while ($x = each($fruits)) {
        echo "element $x[0] of \$fruits is $x[1] <br />";
    }

Run it, and you get

$fruits is 2 elements long
element 0 of $fruits is 
element 1 of $fruits is 
element apple of $fruits is red 
element banana of $fruits is yellow 

online example and source available at:
example <jibsheet.com/phlpm.php>
source  <jibsheet.com/phlpm.phps>

-kevin

-- 
Kevin Falcone <kevinfal@seas.upenn.edu>
The only sensible way to estimate the stability of a Windows 
server is to power it down and try it out as a step ladder.
- Robert Crawford in <8mFo4.13742$wR.921464@news.flash.net>

**Majordomo list services provided by PANIX <URL:http://www.panix.com>**
**To Unsubscribe, send "unsubscribe phl" to majordomo@lists.pm.org**


  • Follow-Ups: