|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2011-12-21 21:02 UTC] pehohlva at gmail dot com
Description:
------------
str_replace() error:
following construct delivers true on using phpexcelreader on ms excelfile as
$item if $item = ord($item)=32
that means, not all whitespaces where found with str_replaces()
Test script:
---------------
foreach($user as $key=>$item)
{
if(trim(str_replace(" ","",$item)) == "")
{
echo"<br>items:".ord($item);
}
}
output will be displayed with ascii 32 (space). Should be not possible.
Expected result:
----------------
dump->NULL
Actual result:
--------------
" " (space ascii 32
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 04 03:00:01 2025 UTC |
str_replace works fine. You're just not using its result. str_replace returns the altered string; it doesn't change the original. Do: $item = str_replace(" ", "", $item);