How to print several small strings in php


Sometime we need to print several small strings. Instead of printing each string, Make them into one string.

<?php
echo 'First string';
echo 'Second string';
echo 'Third string';
echo 'Fourth string';
echo 'Fifth string';

is much slower than

<?php
$result = 'First string';
$result .= 'Second string';
$result .= 'Third string';
$result .= 'Fourth string';
$result .= 'Fifth string';
echo $result;

Advertisements

2 thoughts on “How to print several small strings in php

  1. After I initially commented I clicked the -Notify me when new feedback are added- checkbox and now every time a remark is added I get four emails with the identical comment. Is there any means you can take away me from that service? Thanks!

  2. I will immediately grab your rss as I can’t find your e-mail subscription link or e-newsletter service. Do you’ve any? Kindly let me know so that I could subscribe. Thanks.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s