Reading and writing classes to a file in php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dentrite
Forum Newbie
Posts: 16
Joined: Thu Jun 17, 2010 7:10 am

Reading and writing classes to a file in php

Post 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??
User avatar
Jade
Forum Regular
Posts: 908
Joined: Sun Dec 29, 2002 5:40 pm
Location: VA

Re: Reading and writing classes to a file in php

Post 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
Post Reply