0

How do I convert the value of a PHP variable to string?

I was looking for something better than concatenating with an empty string:

$myText = $myVar . '';

Like the ToString() method in Java or .NET.

Ravi
  • 30,829
  • 42
  • 119
  • 173
  • so what is your question ? what is wrong with mentioned code ? – Ravi Jan 21 '18 at 10:52
  • What is the relationship between the title and the body of your question ? – Syscall Jan 21 '18 at 12:25
  • 1
    The content of the question is exactly the same as https://stackoverflow.com/questions/28098/tostring-equivalent-in-php ... A cut/paste error ? – Syscall Jan 21 '18 at 12:38
  • Possible duplicate of [ToString() equivalent in PHP](https://stackoverflow.com/questions/28098/tostring-equivalent-in-php) – Progman Jan 21 '18 at 15:46

0 Answers0