[ create a new paste ] login | about

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

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

$array = array(
  "Key1"=>($ref = array(
    "Value1",
    "Value2"
  )),
  "Key2"=>&$ref,
  "Key1"=>&$ref
);

print_r($array);

$array['Key2'][] = 'Value3';


print_r($array);


Output:
Array
(
    [Key1] => Array
        (
            [0] => Value1
            [1] => Value2
        )

    [Key2] => Array
        (
            [0] => Value1
            [1] => Value2
        )

)
Array
(
    [Key1] => Array
        (
            [0] => Value1
            [1] => Value2
            [2] => Value3
        )

    [Key2] => Array
        (
            [0] => Value1
            [1] => Value2
            [2] => Value3
        )

)


Create a new paste based on this one


Comments: