We use __toString() to returning class's default value like that:
<?php
class my
{
public function __toString()
{
return "asdasd";
}
}
?>
It returns only string type. But I want to return resource type:
<?php
class my
{
public function __toString()
{
return imagecreatefromjpeg("image.jpg");
}
}
?>
It doesn't work.How to do it?Is there any method instead of __toString() or any way with using __toString?