how can i use foreach to get value and name php -


i want value of variable :

$file = new filefromdb($_get['filename']);   

by trying code :

foreach($file $key => $name){      print_r( "$key => $name"); } 

but dont work , when print $file show

filefromdb object ( [filename:filefromdb:private] => tp4.php )

pliz me how can 'tp4.php' without syntaxe.

$file object type filefromdb. filename private(!) property of object. (your var dump shows this).

to access filename, filefromdb needs provide public method access property:

class filefromdb      ...      public function getfilename() {         return $this->filename;     }      ...  } 

then use this:

$file = new filefromdb($_get['filename']); $filename = $file->getfilename(); 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -