Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
backend
php
oop
classes_objects
85iteration_prop_subclass.php
85iteration_prop_subclass.php
<?php class A { public $pub='Public svojstvo '; protected $prot='Protected svojstvo '; private $priv='Private svojstvo '; } class B extends A{ } class C extends B{ public function ispis(){ foreach($this as $prop=>$val){ echo $prop." = ".$val; echo "<br/>"; } } } //defininranje objekta $obj=new C; $obj->ispis(); /*Zakljucak: foreach iterira public i protected u SUBCLASS podrucju*/ ?>
Reload page
Preview
W3C validation
Edit Code