you can also use the var_dump($my_var) function that works with all variables like objects and is a little shorter to write. (and looks nicer too with bootstrap)
Absolutely, thanks for the comment. I decided to include this just because it's a beginner video and didn't want to introduce the need to explain this.
I think you should make a video about this one, and after all it's less error prone,more intuitive It makes sense when not all languages(like C++/other compiled) has this type of str intepolation,and it trades off the performance,so you don't teach at the first class but its an excellent technic. I didn't use PHP for a long time,but I remember how many time this trick saves me.
I was used to print to Epson printers and all the escape keys in dos! how does it work in windows whether php , c#, vb or what ever I do not have the slightest idea.
Davor Badrov It's important to note that echo is a language constructor, not a function. Arnolds Kļavenieks You can pass a second argument to print_r() to tell PHP to store it instead of output it: echo '' . print_r($arr, true) . '';
Printing Human Readable PHP Variables
you can also use the var_dump($my_var) function that works with all variables like objects and is a little shorter to write. (and looks nicer too with bootstrap)
We have a video out on this very soon too.
You can just write echo "${print_r($arr)}" to do string interpolation version to reduce necessary concatenation
Absolutely, thanks for the comment. I decided to include this just because it's a beginner video and didn't want to introduce the need to explain this.
I think you should make a video about this one,
and after all it's less error prone,more intuitive
It makes sense when not all languages(like C++/other compiled) has this type of str intepolation,and it trades off the performance,so you don't teach at the first class
but its an excellent technic.
I didn't use PHP for a long time,but I remember how many time this trick saves me.
I was used to print to Epson printers and all the escape keys in dos!
how does it work in windows whether php , c#, vb or what ever I do not have the slightest idea.
As you can see, adding the 'true' value (boolean) to the print_r command, will make that '1' number disappear.
Isn´t the output of var_dump($array); the same ?
To avoid writing you could look in the source code.
But that's a little annoying to have to do that.
yeah bcause if u have alot of thing in the source code that will be annoying
Please look back in the other tutorials. Please look at the register/login tutorial plz :) i need help with the .htaccess
Wow, why is it working with commas but not dots?
Echo can take multiple arguments
function description (it's actually a construct):
void echo ( string $arg1 [, string $... ] )
reference: bg2.php.net/manual/en/function.echo.php
Davor Badrov It's important to note that echo is a language constructor, not a function.
Arnolds Kļavenieks You can pass a second argument to print_r() to tell PHP to store it instead of output it:
echo '' . print_r($arr, true) . '';
I love you. wanna marry me?