Bug #67977 [NEW]: Is it the expected behaviour?
| From: | admin at mvpro dot net | Date: | Mon, 08 Sep 2014 11:32:53 +0000 |
| Subject: | Bug #67977 [NEW]: Is it the expected behaviour? | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-187444@lists.php.net to get a copy of this message | ||
From: admin at mvpro dot net
Operating system: Linux Debian Wheezy x64
PHP version: 5.5.16
Package: *General Issues
Bug Type: Bug
Bug description:Is it the expected behaviour?
Description:
------------
Hi.
I have a question - is it the expected behaviour that lines like
strtolower($str);
Do not equals to
$str = strtolower($str);
?
The second line is correct and works fine, but first - is not. No errors
produced, but also it just does not work :) $str most likely is being
lowercased, but string $str stay untouched. The same is with other
functions like
wordwrap($text, 20, "<br />\n");
Do not equals to
$newtext = wordwrap($text, 20, "<br />\n");
In all cases i expect, that action will be performed and string changes.
However it does not happen.
Thanks in advance.
Test script:
---------------
<?php
$str = "Mary Had A Little Lamb and She LOVED It So";
$str = strtolower($str);
echo $str . PHP_EOL; // Prints mary had a little lamb and she loved it
so
echo 'It works fine (all symbols are in lowercase)' . PHP_EOL;
?>
<?php
$str2 = "Mary Had A Little Lamb and She LOVED It So";
strtolower($str2);
echo $str2 . PHP_EOL; // Prints Mary Had A Little Lamb and She LOVED It
So
echo 'It does not work (string is the same)' . PHP_EOL;
?>
--
Edit bug report at https://bugs.php.net/bug.php?id=67977&edit=1
--