|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2010-11-20 11:03 UTC] apanatshka dot thedragoncouncil at gmail dot com
Description: ------------ --- From manual page: http://www.php.net/function.substr-count#Description --- substr_count cannot find a newline when in a string with a carriage return and newline right after eachother Test script: --------------- <?php echo substr_count("\n", "\n"); echo substr_count("\n", "\r\n"); echo substr_count(' ', "\r\n"); //I've changed the following simple string in my script so it only holds a newline character echo substr_count(' ', "\n"); //I've changed the following simple string in my script so it only holds a newline character echo substr_count("\n", ' '); echo substr_count("\n", ' '); echo substr_count(' ', ' '); ?> Expected result: ---------------- 1111111 Actual result: -------------- 1011101 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 17 18:00:01 2025 UTC |
Makes no sense substr_count("\n", "\r\n") returns 1. There is no "\r\n" in "\n".