[ create a new paste ] login | about

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

PHP, pasted on May 11:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
class example
{
    public $array;

    public function __construct()
    {
        $this->array = array();

    }

    public function do_work()
    {
        $this->array[] = 'test';
    }
}
$test = new example();
$test->do_work();
echo $test->array . "\n";
var_dump($test->array);


Output:
1
2
3
4
5
Array
array(1) {
  [0]=>
  string(4) "test"
}


Create a new paste based on this one


Comments: