Printing Human Readable PHP Variables

Поделиться
HTML-код
  • Опубликовано: 24 янв 2025

Комментарии • 17

  • @codecourse
    @codecourse  10 лет назад +2

    Printing Human Readable PHP Variables

  • @stefnoman4407
    @stefnoman4407 10 лет назад

    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)

    • @codecourse
      @codecourse  10 лет назад

      We have a video out on this very soon too.

  • @YTSliv
    @YTSliv 10 лет назад +1

    You can just write echo "${print_r($arr)}" to do string interpolation version to reduce necessary concatenation

    • @codecourse
      @codecourse  10 лет назад +1

      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.

    • @YTSliv
      @YTSliv 10 лет назад

      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.

  • @JoseHNCGroupB2010
    @JoseHNCGroupB2010 10 лет назад

    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.

  • @ovidiudrobota2182
    @ovidiudrobota2182 10 лет назад

    As you can see, adding the 'true' value (boolean) to the print_r command, will make that '1' number disappear.

  • @TheAluminus
    @TheAluminus 10 лет назад

    Isn´t the output of var_dump($array); the same ?

  • @Wiejeben
    @Wiejeben 10 лет назад

    To avoid writing you could look in the source code.

    • @codecourse
      @codecourse  10 лет назад

      But that's a little annoying to have to do that.

    • @HishamHadraoui
      @HishamHadraoui 10 лет назад

      yeah bcause if u have alot of thing in the source code that will be annoying

  • @Matcho-dd3py
    @Matcho-dd3py 10 лет назад

    Please look back in the other tutorials. Please look at the register/login tutorial plz :) i need help with the .htaccess

  • @ArnoldsKtm
    @ArnoldsKtm 10 лет назад

    Wow, why is it working with commas but not dots?

    • @davorbadrov123
      @davorbadrov123 10 лет назад

      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

    • @terryharvey5135
      @terryharvey5135 10 лет назад +2

      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) . '';

  • @HerbivoreJesus
    @HerbivoreJesus 10 лет назад

    I love you. wanna marry me?