Difference between spaces with "\t", "\r" or a simple space
playboy-1990
Posted messages
593
Status
Member
-
boly38 Posted messages 267 Registration date Status Member Last intervention -
boly38 Posted messages 267 Registration date Status Member Last intervention -
Hello,
In PHP for example you can create spaces with ""\t"" (tab), ""\r"" (carriage return)
or even "" ""
Here is an example
But what is the real difference ?
and why must the signs ""\r"" etc be surrounded by double quotes ?
To finish which is the fastest ?
Thanks
In PHP for example you can create spaces with ""\t"" (tab), ""\r"" (carriage return)
or even "" ""
Here is an example
<?php print 'Bonjour' . "\r" . $membre . "\t" . 'vous avez' . ' ' . $score . "\r" . 'score !';
But what is the real difference ?
and why must the signs ""\r"" etc be surrounded by double quotes ?
To finish which is the fastest ?
Thanks
1 answer
Hello,
the difference between each "escaped sequence" mentioned is their ASCII representation. A tabulation does not appear the same way as a newline or as a space..
cf. https://fr.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange
> why the double quotes?
PHP says it: I quote the PHP.net manual: https://www.php.net/manual/fr/language.types.string.php
"If the string is enclosed in double quotes ("), PHP will interpret more escape sequences for special characters
>To finish, which is faster?
Hard to understand this question. I would say that each escape sequence occupies the same amount of memory, so they are equivalent in terms of data transfer..
the difference between each "escaped sequence" mentioned is their ASCII representation. A tabulation does not appear the same way as a newline or as a space..
cf. https://fr.wikipedia.org/wiki/American_Standard_Code_for_Information_Interchange
> why the double quotes?
PHP says it: I quote the PHP.net manual: https://www.php.net/manual/fr/language.types.string.php
"If the string is enclosed in double quotes ("), PHP will interpret more escape sequences for special characters
>To finish, which is faster?
Hard to understand this question. I would say that each escape sequence occupies the same amount of memory, so they are equivalent in terms of data transfer..