B
B
Barney_Gubmle2018-11-02 18:07:54
PHP
Barney_Gubmle, 2018-11-02 18:07:54

Why notice swears?

Good day!
I will try to correctly paint my thoughts, thanks to those who have the patience to read.
There is an abstract class A.
There is a singleton B that inherits A
there is a class C that inherits A
Everything would be fine, but A has a recursive method and a $array variable that re-calls itself. if it does not find the desired number
if $i is more than two, then we start looking for $i in class C, before that we are looking in class B,
I hope I didn’t confuse

abstract class A 
{
  $arr = array();
  public static function test($array, $i)
  {
  if(empty($array->arr[$i]))
    {
     $i++;
     self::test($array->arr[$i], $i)
    }
  }
}

and the function seems to work.
Nooo, notes swear
Notice: Accessing static property C::$arr as non static

I so suspect that it swears because it
($array->arr[$i], $i)
is caused somehow not so.
It seems to me that I "look far away" And the decision is right under my nose.
Poke please, no slippers. Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav, 2018-11-02
@Barney_Gubmle

Specify the visibility of the $arr variable. For example public. And what is passed to the test method specifically?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question