Why can't you get methods from a class?

Hi guys why I can not get methods from a class using foreach

Here is an example.
class Func
{
 public function one() { return 'test';}
}

$new = new Func();

foreach($new as $Item)
{
 echo $Item->(Here it does not see available methods)
}


Whether it is possible as that to correct this?
June 27th 19 at 14:54
2 answers
June 27th 19 at 14:56
Therefore, you do not. Using foreach doesn't work.

If you need a list of available methods on the object, then, suddenly... the first link from https://www.google.ru/search?q=php+object+methods
If you need a complete list of methods of an object, use reflection. I am sure that the keywords php object method reflection will help in the search.

Try first to look for information yourself, and then ask questions.
June 27th 19 at 14:58
Google the Iterator interface from SPL.
It is possible to make objects iterable via foreach.

Find more questions by tags PHP