All of the following commands work but which one is considered correct in terms of security, compatibility, speed, and other conventions?
//one
echo "$row->first_name $row->last_name <br />";
//two
echo $row->first_name . ' ' . $row->last_name .'<br />';
//three
echo $row->first_name;
echo $row->last_name;
echo '<br />';
Although not one of the styles you specified, I recommend using braces for echo-ing strings, mostly on compatibility note.
echo "Welcome back, {$row->first_name} {$row->last_name}";
More information about this type of syntax can be found in PHP Strings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With