Jump to content

[php] Array i wyszukiwanie po klasie


dj.drezyna

Recommended Posts

mało ładnie ale działa, jak wymyślę lepszy sposób(poza pętlą) to dam znać

class foo{

   public function __tostring(){
  	 return get_class($this);

   }
}



$arr=array(
    0=>'a'
   ,1=>'b'
   ,2=>2
   ,3=>new foo()
   ,4=>3
   ,5=>new foo()
   );

var_dump(array_keys($arr,'foo'));// return: array(2) { [0]=> int(3) [1]=> int(5) }

Link to comment
Share on other sites

  • 4 years later...

Archived

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

×
×
  • Create New...