Answers for "type cast to string in php"

PHP
1

php convert to string

<?php
class StrValTest
{
    public function __toString()
    {
        return __CLASS__;
    }
}

// Prints 'StrValTest'
echo strval(new StrValTest);
?>
Posted by: Guest on April-02-2020
0

php object to string

__toString() & {$this->name}
Posted by: Guest on June-27-2020

Browse Popular Code Answers by Language