|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-06-19 02:53 UTC] youbuwei at yeah dot net
Description: ------------ the result of "rtrim" function and "ltrim" function and "trim" function is same. Test script: --------------- <?php $str = '---12323123123---'; echo trim($str, '-'); echo "\n"; echo rtrim($str, '-'); echo "\n"; echo ltrim($str, '-'); echo "\n"; Expected result: ---------------- 12323123123 ---12323123123 12323123123--- Actual result: -------------- 12323123123 12323123123 12323123123 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 03:00:02 2025 UTC |
my terminal output is: Ruolongs-MacBook-Pro:test Ruolong$ php -v PHP 7.0.7 (cli) (built: Jun 18 2016 10:52:35) ( NTS ) Copyright (c) 1997-2016 The PHP Group Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies with Xdebug v2.4.0RC3, Copyright (c) 2002-2015, by Derick Rethans Ruolongs-MacBook-Pro:test Ruolong$ cat index.php <?php $str = '---12323123123---'; echo trim($str, '-'); echo "\n"; echo rtrim($str, '-'); echo "\n"; echo ltrim($str, '-'); echo "\n"; Ruolongs-MacBook-Pro:test Ruolong$ php -f index.php 12323123123 12323123123 12323123123