note 114098 added to function.filter-input-array

From: Date: Fri, 10 Jan 2014 16:40:15 +0000
Subject: note 114098 added to function.filter-input-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-198196@lists.php.net to get a copy of this message
[New Version] Example Usage: <?php $_GET['A']['a'] = ' CORRECT(including some spaces) '; $_GET['A']['b'] = ' CORRECT(including some spaces) '; $_GET['A']['c'] = "Invalid UTF-8 sequence: \xe3\xe3\xe3"; $_GET['A']['d']['invalid_structure'] = 'INVALID'; $_GET['B']['a'] = ' CORRECT(including some spaces) '; $_GET['B']['b'] = "Invalid UTF-8 sequence: \xe3\xe3\xe3"; $_GET['B']['c']['invalid_structure'] = 'INVALID'; $_GET['B']["Invalid UTF-8 sequence: \xe3\xe3\xe3"] = 'INVALID'; $_GET['C']['a'] = ' CORRECT(including some spaces) '; $_GET['C']['b'] = "Invalid UTF-8 sequence: \xe3\xe3\xe3"; $_GET['C']['c']['invalid_structure'] = 'INVALID'; $_GET['C']["Invalid UTF-8 sequence: \xe3\xe3\xe3"] = 'INVALID'; $_GET['unneeded_item'] = 'UNNEEDED'; var_dump(filter_struct_utf8(INPUT_GET, array( 'A' => array( 'a' => '', 'b' => FILTER_STRUCT_TRIM, 'c' => '', 'd' => '', ), 'B' => FILTER_STRUCT_FORCE_ARRAY, 'C' => FILTER_STRUCT_FORCE_ARRAY | FILTER_STRUCT_TRIM, ))); ?> Example Result: array(3) { ["A"]=> array(4) { ["a"]=> string(36) " CORRECT(including some spaces) " ["b"]=> string(30) "CORRECT(including some spaces)" ["c"]=> string(0) "" ["d"]=> string(0) "" } ["B"]=> array(3) { ["a"]=> string(36) " CORRECT(including some spaces) " ["b"]=> string(0) "" ["c"]=> string(0) "" } ["C"]=> array(3) { ["a"]=> string(30) "CORRECT(including some spaces)" ["b"]=> string(0) "" ["c"]=> string(0) "" } } ---- Server IP: 192.41.45.150 Probable Submitter: 219.209.194.119 ---- Manual Page -- http://php.net/manual/en/function.filter-input-array.php Edit -- https://master.php.net/note/edit/114098 Del: integrated -- https://master.php.net/note/delete/114098/integrated Del: useless -- https://master.php.net/note/delete/114098/useless Del: bad code -- https://master.php.net/note/delete/114098/bad+code Del: spam -- https://master.php.net/note/delete/114098/spam Del: non-english -- https://master.php.net/note/delete/114098/non-english Del: in docs -- https://master.php.net/note/delete/114098/in+docs Del: other reasons-- https://master.php.net/note/delete/114098 Reject -- https://master.php.net/note/reject/114098 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#198196) next »