Jump to content

[SOLVED] problem with a static array __


faizulbari

Recommended Posts

<?php

class foo

{

      public static $arr = array(0 => 1,2,2,3,4);

      public function foo()

    {

    }

    public function test()

    {

          echo "X".$arr[3]."X";

    }

}

?>

 

<?php

 

      $f = new foo();

      $f->test(); 

 

?>

 

 

it should print "X2X" but it prints "XX"

 

i can't understand whats the problem here???

plz help

Link to comment
https://forums.phpfreaks.com/topic/36911-solved-problem-with-a-static-array-__/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.