Re: Arrays/Hashes

From: Date: Tue, 18 Dec 2001 16:59:20 +0000
Subject: Re: Arrays/Hashes
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-78082@lists.php.net to get a copy of this message
I've noticed this, too. There are at least two things you can do to make them work... print("Some text {$myhash['mykey']}<BR>\n") or print("Some text ".$myhash['mykey']."<BR>\n") jim
Hey there, sortta simple question... Is it just me or can't you access hashes within strings? This works... print("Some text $myarray[0]<BR>\n"); This doesn't print("Some text $myhash['mykey']<BR>\n"); i'm asking in relation to databases (not that that matters). If i fetch a row from the database I can use the $array[0], [1], etc in the print statements if i use mysql_fetch_array (oh sorry, u people call it associative arrays instead of hashes, my mistake) i can't access $array['fieldname'] from within a print statement but I CAN do $DBID = $resultarray['idfieldname']; and then use $DBID..... regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net
-- Jim Musil --------- Multimedia Programmer Nettmedia ------------- 212-629-0004 jim@nettmedia.com

« previous php.general (#78082) next »