Answers for "php get variable to string"

PHP
14

integer to string php

return strval($integer);
Posted by: Guest on April-06-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
1

convert to string php

echo "'$animal'";
Posted by: Guest on January-27-2021
0

php get variable by string name

${$variableName} or $$variableName;

//example:

$variableName = 'foo';
$foo = 'bar';

// The following are all equivalent, and all output "bar":
echo $foo;
echo ${$variableName};
echo $$variableName;
Posted by: Guest on January-04-2021

Browse Popular Code Answers by Language