ltrim behavior.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This might be old for some of you but I never encountered it until
today and I would like to know why this is happening.

Here's the situation:
php > $a='data[options][name]';
php > echo ltrim($a,'data[');
options][name]

Just as I expected.

Next one:
php > $a='options[options][name]';
php > echo ltrim($a,'options[');
][name]

UH, what?
Not exactly what I expected.

This works:
php > $a='options[options][name]';
php > echo ltrim(ltrim($a,'options'),'[');
options][name]

Can somebody explain the second behavior? Is this a known bug in PHP,
I'm running PHP 5.2.6 on Ubuntu.

-- 
Peter van der Does

GPG key: E77E8E98

WordPress Plugin Developer
http://blog.avirtualhome.com

GetDeb Package Builder/GetDeb Site Coder
http://www.getdeb.net - Software you want for Ubuntu

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux