note 82575 added to function.trim

From: Date: Wed, 16 Apr 2008 23:50:35 +0000
Subject: note 82575 added to function.trim
Groups: php.notes 
Request: Send a blank email to php-notes+get-138389@lists.php.net to get a copy of this message
admin at semaster dot ru's array_trim function is flawed in that it will change the type of nulls and numeric variables (to strings). Here is a better version, although it lacks charlist support: <?php function array_trim($var) { if (is_array($var)) return array_map("array_trim", $var); if (is_string($var)) return trim($var); return $var; } ?> -Rob ---- Server IP: 87.124.64.96 Probable Submitter: 81.104.180.244 ---- Manual Page -- http://www.php.net/manual/en/function.trim.php Edit -- https://master.php.net/note/edit/82575 Del: integrated -- https://master.php.net/note/delete/82575/integrated Del: useless -- https://master.php.net/note/delete/82575/useless Del: bad code -- https://master.php.net/note/delete/82575/bad+code Del: spam -- https://master.php.net/note/delete/82575/spam Del: non-english -- https://master.php.net/note/delete/82575/non-english Del: in docs -- https://master.php.net/note/delete/82575/in+docs Del: other reasons-- https://master.php.net/note/delete/82575 Reject -- https://master.php.net/note/reject/82575 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#138389) next »