|   | php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
| 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits              [2013-06-24 04:27 UTC] stas@php.net
  [2013-06-24 04:27 UTC] stas@php.net
 
-Status: Open
+Status: Closed
  [2013-06-24 04:27 UTC] stas@php.net
  [2014-10-07 23:18 UTC] stas@php.net
  [2014-10-07 23:29 UTC] stas@php.net
 | |||||||||||||||||||||||||||
|  Copyright © 2001-2025 The PHP Group All rights reserved. | Last updated: Fri Oct 31 14:00:01 2025 UTC | 
Description: ------------ See test script below. The strangest behavior is the difference between a pure ASCII string and an UTF-8 with chars in the [80-FFFF] range. The other wrong thing is the difference of behavior between substr() and grapheme_substr(). I think substr's behavior is the good one. Test script: --------------- <?php var_dump(substr('deja', 1, -4)); var_dump(substr('deja', -1, 0)); var_dump(grapheme_substr('deja', 1, -4)); var_dump(grapheme_substr('deja', -1, 0)); var_dump(grapheme_substr('déjà', 1, -4)); var_dump(grapheme_substr('déjà', -1, 0)); ?> Expected result: ---------------- bool(false) string(0) "" bool(false) string(0) "" bool(false) string(0) "" Actual result: -------------- bool(false) string(0) "" bool(false) string(0) "" string(5) "éjà" bool(false)