Er hægt að koma af stað smá umræðu með spurningu um php: hvort finnst ykkur betra að nota print eða echo, rökstuðningur væri góður :)
btw ég nota echo en hef enga útskýringu á því :P
print vs echo
Even both of these output mechanism are language constructs, if you benchmark the two you will quickly discover that print() is slower then echo(). The reason for that is quite simple, print function will return a status indicating if it was successful or not, while echo simply print the text and nothing more. Since in most cases (haven't seen one yet) this status is not necessary and is almost never used it is pointless and simply adds unnecessary overhead.
$oQueryString = sprintf("SELECT %s FROM tafla WHERE uid = '%d'", join(',', array_values( $aValues ) ), $id);
echo prints in a big empty room.
print "I can't find my pet plant" or die("Failed printing, ever so rare.");
<?php $printed = print "flottur strengur maður!"; if( !printed ) { print "tókst ekki að prenta strenginn :("; } else { print "prentaði flotta strenginn"; } ?>
<?php function failedprint() { $gaur = print "Tókst ekki að prenta!"; if( !$gaur ) { failedprint(); return false; } else { return true; } } $gaur = print "Flottur strengur!"; if( !$gaur ) { failedprint(); } ?>