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
Post a Comment