arrays and strings... a little confusing.

From: Date: Tue, 08 May 2001 00:53:14 +0000
Subject: arrays and strings... a little confusing.
Groups: php.general 
Request: Send a blank email to php-general+get-51846@lists.php.net to get a copy of this message
Whats is the difference between [] and {} ? define(NL,"<br>\n"); $str="How do you do?"; echo $str[3].NL; echo $str{3}.NL; $array = array("how","do","you","do?"); echo $array[2].NL; echo $array{2}.NL; this outputs d d you you so there's no difference right? When does a string become an array and vice-versa? if I do $str=(array)$str; then $str[0] will contain "How do you do?" but if I do $array=(string)$array then $array contains the string "Array", so it doesn't work both ways. How does PHP works with this? I come from C where a string and an array of char is exactly the same thing, so this kinda confuses me. ____________________________ . Christian Dechery (lemming) . http://www.tanamesa.com.br . Gaita-L Owner / Web Developer

« previous php.general (#51846) next »