'When using the substr() string function, Why is a litteral carriage return twice as long as a line feed character "\n"?
When typing the following code ... (easily testable with W3schools' editor)
<?php
$basecss = '.class {
margin-bottom:0
}
/*1234567890';
$basemincss = ".class {\n\tmargin-bottom:0\n}\n/*1234567890";
echo substr($basecss,0,35).'*/';
echo '<br><br>';
echo substr($basemincss,0,35).'*/';
?>
... The results are :
.class {
margin-bottom:0
}
/*12*/
.class {
margin-bottom:0
}
/*12345*/
So why does replacing a string's return carriages by line feed characters also reduces its length?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|