Re: array or list of objects of different types

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

 



Php Developer wrote:
> Hi all,
> 
> I want to be able to have an array of elements of different types. As an example: the first element is a boolean, the second is an integer, and the thirs is a string.
> 
> In php there is no typing, i'm just wondering if there is a way to have that, it would be a lot better than having an array of strings and have to convert each element.
> 

var_dump( array( true , 12 , "php already does this" ) );

array(3) {
  [0]=> bool(true)
  [1]=> int(12)
  [2]=> string(21) "php already does this"
}

:)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux