I have some code:
Test Controller:
Class test extends CI_Controller{
public function print_object(){
$x = (object) array('a'=>'A', 'b'=>'B', 'C');
echo '<pre>'.print_r($x, true).'</pre>';
}
}
Test2 Controller:
Class test2 extends CI_Controller{
public function get_printed_object(){
$url = "http://localhost/project/test/print_object";
(object) $str = file_get_contents($url);
echo $str->a; //won't make it. resulting error
}
}
the line
echo $str->a;
was resulted a warning : Trying to get property of non-object
Is it possible for me to re-make the $x object that was printed to string?