1 2 3 4 5 6 7
<?php $name = "test"; echo "Die ist ein : " . $name; ?>
Refactorings
No refactoring yet !
Eineki
June 2, 2009, June 02, 2009 10:41, permalink
maybe you can use the comma (,) instead of dot (.) you save the unnecessary concatenation (somewhere I read it is somewhat quicker)
1 2 3 4 5 6 7
<?php $name = "test"; echo "Die ist ein : " , $name; ?>
okais.myopenid.com
June 2, 2009, June 02, 2009 12:06, permalink
ok,
I knew it only with the "." .I've never seen "," ;)
Adam
June 2, 2009, June 02, 2009 14:56, permalink
1 2 3 4 5 6 7
<?php $name = "test"; echo "Die ist ein : $name"; ?>
bob
June 2, 2009, June 02, 2009 17:53, permalink
1 2 3 4 5 6 7
<?php $name = "test"; echo "Die ist ein : $name"; ?>
Anonymous
June 2, 2009, June 02, 2009 20:02, permalink
Two ideas:
If $name is a constant, don't make it look like a variable.
If $name can in any way modified by the user, don't forget to remove all HTML markup (and adapt the encoding to your page's, if necessary)
Handing two arguments to "echo" instead of concatenating the arguments yourself gives you a marginal speed boost, but in general I wouldn't worry about that.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
<?php define("NAME", "test"); echo("Die ist ein : ", NAME); ?> -or- <?php $name_raw = "test"; $name = htmlspecialchars($name_raw, ENT_NOQUOTES, 'UTF-8') echo("Die ist ein : ", $name); ?>
Standard PHP Ausgabe mti Variable