Re: define ('NL', "<br />"); can I define a constant var ? [message #180187 is a reply to message #180182] |
Wed, 23 January 2013 00:35 |
M. Strobel
Messages: 386 Registered: December 2011
Karma:
|
Senior Member |
|
|
Am 22.01.2013 20:08, schrieb Luuk:
> On 22-01-2013 19:58, Tim Streater wrote:
>> In article <6833t9-kme(dot)ln1(at)luuk(dot)invalid(dot)lan>, Luuk <luuk(at)invalid(dot)lan>
>> wrote:
>>
>>> On 22-01-2013 09:39, Arno Welzel wrote:
>>>> cate, 2013-01-22 01:06:
>>
>>>> With variables this would be easier though:
>>>>
>>>> $NL = '<br />';
>>>> echo "This is $NL another line";
>>>>
>>>
>>> Why do you use single quotes on the first line,
>>> and double on the second?
>>>
>>> Why not simply use double-quotes everywhere.....
>>>
>>> $NL = "<br />";
>>> echo "This is $NL another line";
>>
>> Because the interpreter has to do more work with the string:
>>
>> <http://php.net/manual/en/language.types.string.php>
>>
>> If you do:
>>
>> $NL = '<br />';
>> echo 'This is ' . $NL . 'another line';
>>
>> then you avoid the double-quote altogether.
>>
>
> and who is going to notice those msecs ?
Nobody. It's a question of style, and showing if you know what you are doing.
/Str.
|
|
|