[ create a new paste ] login | about

Link: http://codepad.org/9nc0eJHk    [ raw code | output | fork ]

PHP, pasted on Oct 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<?php

$obj = new stdClass; $obj->{5} = 'A';

$objArr = (array) $obj;
var_dump($objArr);

var_dump($objArr[5]);
var_dump($objArr['5']);
var_dump($objArr[strval('5')]);

// -----------------

$arr = array (5 => 'A');
var_dump($arr);

var_dump($arr[5]);
var_dump($arr['5']);
var_dump($arr[strval('5')]);


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
array(1) {
  ["5"]=>
  string(1) "A"
}
NULL
NULL
NULL
array(1) {
  [5]=>
  string(1) "A"
}
string(1) "A"
string(1) "A"
string(1) "A"


Create a new paste based on this one


Comments: