note 87200 added to function.trim
| From: | chriscohen at osu1 dot php dot net | Date: | Mon, 24 Nov 2008 11:14:21 +0000 |
| Subject: | note 87200 added to function.trim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-146857@lists.php.net to get a copy of this message | ||
@Brizz,
Getting a string containing the word "Array" IS the expected behaviour if you try to use
this function on an array. The array will be cast to a string before it is trimmed, and as you
already know, casting an array to a string will yield "Array" - printing an array will
print the word "Array". These two will print the same thing:
<?php
$array = array(1, 2, 3);
// Both of these will yield the word Array.
print trim("Array");
print trim($array);
?>
----
Server IP: 92.48.74.199
Probable Submitter: 217.205.183.82
----
Manual Page -- http://www.php.net/manual/en/function.trim.php
Edit -- https://master.php.net/note/edit/87200
Del: integrated -- https://master.php.net/note/delete/87200/integrated
Del: useless -- https://master.php.net/note/delete/87200/useless
Del: bad code -- https://master.php.net/note/delete/87200/bad+code
Del: spam -- https://master.php.net/note/delete/87200/spam
Del: non-english -- https://master.php.net/note/delete/87200/non-english
Del: in docs -- https://master.php.net/note/delete/87200/in+docs
Del: other reasons-- https://master.php.net/note/delete/87200
Reject -- https://master.php.net/note/reject/87200
Search -- https://master.php.net/manage/user-notes.php