Answers for "convert var to string php"

PHP
5

php to string

$number = 10;
// To convert this number to a string:
$numberString = (string)$number;
Posted by: Guest on October-30-2020
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

Browse Popular Code Answers by Language