Page 1 of 1

Reading and writing classes to a file in php

Posted: Thu Jun 02, 2011 10:46 am
by dentrite
hi, i have searched every where but could not get how to write or read objects of class or stucture in file through php. for ex. if i had structure like this in c++,

Code: Select all

str student { int roll;char name[50]; } 
then we can easily write it into a file through file.write() function. Is there anyway to do the same in php??

Re: Reading and writing classes to a file in php

Posted: Thu Jun 02, 2011 11:02 am
by Jade
you can call var_dump() on an object or use this to dump the contents of your class file: http://www.php.net/manual/en/function.f ... ntents.php