3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $str = M_PI; $a = strval($str); $b = (string)$str; $c = "$str"; $d = $str.""; $e = $str; settype($e, "string"); var_dump($a); var_dump($b); var_dump($c); var_dump($d); var_dump($e);
based on GJHCq
Output for 4.3.0 - 7.2.0
string(15) "3.1415926535898" string(15) "3.1415926535898" string(15) "3.1415926535898" string(15) "3.1415926535898" string(15) "3.1415926535898"