Re: Re: jumping between php and html or using echo for printing html-tags.

From: Date: Mon, 10 Feb 2003 10:42:34 +0000
Subject: Re: Re: jumping between php and html or using echo for printing html-tags.
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-135030@lists.php.net to get a copy of this message
Then why not use single quotes, its faster than double quotes, and you could also use comma instead of full stop (echo can take multiple parameters, which is faster than building up a new string) function admin_menu() { echo '<B> Meny </B><BR>'; echo '<A HREF="' , $_SERVER['PHP_SELF'] , '?action=' , MANAGE_MEMBERS ,'">Medlemmar</A><BR>'; Askengren wrote:
I do not know why so many developers use the "-character (double quote) instead of ' (single quote) in php/html-scripts. Much easier is: function admin_menu() { echo "<B> Meny </B><BR>"; echo "<A HREF='" . $_SERVER['PHP_SELF'] . "?action=" . MANAGE_MEMBERS ."'>Medlemmar</A><BR>"; ..... You do then not have to worry about all backslashes. And single quote is w3c html-standard just as double quote. And it?s faster - you do not have to switch between html and php so often. /Håkan "Anders Thoresson" <listor@thoresson.net> skrev i meddelandet news:oprj6xvc1vzzwwoi@mail.darkface.pp.se...
Which is more efficient: function admin_menu() { echo "<B> Meny </B><BR>"; echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" . MANAGE_MEMBERS . "\">Medlemmar</A><BR>"; echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" . MANAGE_ALBUMS . "\">Album</A><BR>"; echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" . INITIAL_PAGE . "\">Huvudmeny</A><BR>"; echo "<A HREF=\"" . $_SERVER['PHP_SELF'] . "?action=" . LOG_OUT . "\">Logga ut</A><BR>"; } or function admin_menu() { ?> <B> Meny </B><BR> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php echo(MANAGE_MEMBERS) ;?>">Medlemmar</A><BR> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php echo(MANAGE_ALBUMS) ;?>">Album</A><BR> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php echo(INITIAL_PAGE) ;?>">Huvudmeny</A><BR> <A HREF="<?=$_SERVER['PHP_SELF']?>?action=<?php echo(LOG_OUT);?>">Logga ut</A><BR> <?php } Any reasons other than speed to choose either? -- anders thoresson


« previous php.general (#135030) next »