[ create a new paste ] login | about

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

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

  class foo {
    public $bar = "fizzbuzz";
  }

  class myClass {
    static public $array = array();
    static public function init() {
      while ( count( self::$array ) < 3 )
        array_push( self::$array, new foo() );
    }
  }

  myClass::init();
  print_r( myClass::$array );


Output:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
Array
(
    [0] => foo Object
        (
            [bar] => fizzbuzz
        )

    [1] => foo Object
        (
            [bar] => fizzbuzz
        )

    [2] => foo Object
        (
            [bar] => fizzbuzz
        )

)


Create a new paste based on this one


Comments: