I'm a beginner in PHP. I want to use var_dump($var1)
to get the format
string(10)"I Love PHP"
When i use the function in sublime text editor, the output format is:
string 'I Love PHP' (length=10)
Note: I'm using xampp
and xdebug
.
I'm a beginner in PHP. I want to use var_dump($var1)
to get the format
string(10)"I Love PHP"
When i use the function in sublime text editor, the output format is:
string 'I Love PHP' (length=10)
Note: I'm using xampp
and xdebug
.
If you are dealing with scalar types (string, integers, floats), you can do something like:
echo "'" . gettype($var) . "'(length=" . strlen((string) $var) . ')';
Doing this for every case would require more work, like testing if it is an array and replacing strlen() with count(), and deciding what you want to do with objects and resources.