note 120269 added to function.trim

From: Date: Sat, 03 Dec 2016 21:57:08 +0000
Subject: note 120269 added to function.trim
Groups: php.notes 
Request: Send a blank email to php-notes+get-207969@lists.php.net to get a copy of this message
To trim() each value of an $_POSTS array, i've try custom not working filters and others examples like the default above trim() example with array_walk (that maybe i'm wrong, but on my tests it reset array values, like another with array filter, that work only on php 5.6, but not in 7 (and i had to add return in these cases for my tests inside methods)) but inside a class, a call like: array_walk($fruit, 'self::trim_value'); where the trim_value is the above example function, was not working for me, at best, working on php 5.6, and not in 7, where values were passed same as before, or empty. So i've do this to trim() each $_POST array value, within the function: $k = array_keys($_POST['conf']); $v = array_values($_POST['conf']); foreach($v as $vv): $vvv[] = trim($vv); endforeach; $v = array_values($vvv); $postconf = array_combine ($k ,$v); // $postconf look like $_POST['conf'] now, but with all values of $_POST['conf'] trimmed on 5.6 and 7 ---- Server IP: 72.52.91.14 Probable Submitter: 87.20.185.44 ---- Manual Page -- http://php.net/manual/en/function.trim.php Edit -- https://master.php.net/note/edit/120269 Del: integrated -- https://master.php.net/note/delete/120269/integrated Del: useless -- https://master.php.net/note/delete/120269/useless Del: bad code -- https://master.php.net/note/delete/120269/bad+code Del: spam -- https://master.php.net/note/delete/120269/spam Del: non-english -- https://master.php.net/note/delete/120269/non-english Del: in docs -- https://master.php.net/note/delete/120269/in+docs Del: other reasons-- https://master.php.net/note/delete/120269 Reject -- https://master.php.net/note/reject/120269 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#207969) next »