| Posted by Norman Peelman on 06/20/05 03:02 
"Daniel Tryba" <partmapsswen@invalid.tryba.nl> wrote in messagenews:42b3a2e9$0$13415$c5fe704e@news6.xs4all.nl...
 > Norman Peelman <npeelman@cfl.rr.com> wrote:
 > >> aparently the line "  echo $name[nname].', '.$name[vname]."<br />";"
 > >
 > > Which is ugly in itself... try:
 > >
 > > echo "$name[nname], $name[vname]<br/>";
 >
 > Which is considered bad code:
 >
 http://www.php.net/manual/en/language.types.array.php#language.types.array.donts
 
 Look alittle farther down the page under 'More examples to demonstrate
 this fact:' and you will see:
 
 // The following is okay as it's inside a string.  Constants are not
 // looked for within strings so no E_NOTICE error here
 print "Hello $arr[fruit]";      // Hello apple
 
 // With one exception, braces surrounding arrays within strings
 // allows constants to be looked for
 print "Hello {$arr[fruit]}";    // Hello carrot
 print "Hello {$arr['fruit']}";  // Hello apple
 
 --- end ---
 
 Norman
 ---
 FREE Avatar Hosting at www.easyavatar.com
  Navigation: [Reply to this message] |