<?php

// First, create an array.  Here are two ways :

// first method :
    $array = array('a' => 33,'b' => 99,'c' => 383);
 
// another method :

    $array[a] = 33;
    $array[b] = 99;
    $array[c] = 383;
 
// Those are identical.  Next, let's print all of them.

foreach ($array as $key => $value) {

    print "<br>$key equals $value \n";
    
}   
 
// That will print them all.  Now, let's say you wanted :

// $a = 33 , $b = 99 and $c = 383
    
// Then do this :

    extract($array);

// This will print 33

    print $a; 

?>

Of course this does not explain everything about arrays but I think it
refers to your question.

Regards,

Philip Olson
http://www.cornado.com/


On Thu, 11 Jan 2001, jim davis wrote:

> Hello again!  Ok, so I will give up the idea of calling a function from
> one php page and having that function return its value to another php
> page... BUT I was looking at the "php handbook" and found that I could
> return an array! this is the example thay gave:
> 
> function small_numbers() {
>    return array (0, 1, 2);
> }
> list ($zero, $one, $two) = small_numbers();
> 
> ok, that works fine for small arrays, but what if I had an array that
> was 20 or more elements big?  Is there a way of returning a generic
> sized array?  such as 'return array ($var[]);' ?  I tried it, and it
> yelled at me, so I know that the above syntax is wrong, but is there an
> "easier" way?
> Thanks!
> 
> -Jim
> 
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
> 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to