note 114096 added to function.extract
| From: | CertaiN | Date: | Fri, 10 Jan 2014 16:38:27 +0000 |
| Subject: | note 114096 added to function.extract | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-198194@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: 72.52.91.14
Probable Submitter: 72.52.91.14
----
Manual Page -- http://php.net/manual/en/function.extract.php
Edit -- https://master.php.net/note/edit/114096
Del: integrated -- https://master.php.net/note/delete/114096/integrated
Del: useless -- https://master.php.net/note/delete/114096/useless
Del: bad code -- https://master.php.net/note/delete/114096/bad+code
Del: spam -- https://master.php.net/note/delete/114096/spam
Del: non-english -- https://master.php.net/note/delete/114096/non-english
Del: in docs -- https://master.php.net/note/delete/114096/in+docs
Del: other reasons-- https://master.php.net/note/delete/114096
Reject -- https://master.php.net/note/reject/114096
Search -- https://master.php.net/manage/user-notes.php