consider i have a class
now i want to write the same
for example
i get an error "cannot convert obj. to string" is there any other way to write objects to a file as we do in c++
PHP Code:
class STORE
{
public $string;
public $int;
public $boo;
}
for example
PHP Code:
$obj=new STORE;
$obj->string="some string";
$obj->int=100;
$obj->bool=true;
$stream=fopen("file.dat","wb");
fwrite((char*)&$obj,sizeof($obj)); /*this is a c++ code line,i want to convert the code into php */
fclose($stream);
Comment