note 117129 added to language.types.array
| From: | perske at uni-muenster dot de | Date: | Sat, 18 Apr 2015 23:16:22 +0000 |
| Subject: | note 117129 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-202297@lists.php.net to get a copy of this message | ||
Regarding this note: âStrings containing valid integers will be cast to the integer
type.â
This is true only for decimal integers without leading â+â, but not for octal,
hexadecimal, or binary integers.
Example:
<?php
$array = array(
"0" => "a",
"-1" => "b",
"+1" => "c",
"00" => "d",
"01" => "e",
"0x1" => "f",
);
var_dump($array);
?>
This example will output:
array(7) {
[0]=>
string(1) "a"
[-1]=>
string(1) "b"
["+1"]=>
string(1) "c"
["00"]=>
string(1) "d"
["01"]=>
string(1) "e"
["0x1"]=>
string(1) "f"
}
Thus different strings are always mapped to different array keys.
----
Server IP: 72.52.91.14
Probable Submitter: 37.24.132.116
----
Manual Page -- http://php.net/manual/en/language.types.array.php
Edit -- https://master.php.net/note/edit/117129
Del: integrated -- https://master.php.net/note/delete/117129/integrated
Del: useless -- https://master.php.net/note/delete/117129/useless
Del: bad code -- https://master.php.net/note/delete/117129/bad+code
Del: spam -- https://master.php.net/note/delete/117129/spam
Del: non-english -- https://master.php.net/note/delete/117129/non-english
Del: in docs -- https://master.php.net/note/delete/117129/in+docs
Del: other reasons-- https://master.php.net/note/delete/117129
Reject -- https://master.php.net/note/reject/117129
Search -- https://master.php.net/manage/user-notes.php