How to “echo” a class?

后端 未结 5 934
深忆病人
深忆病人 2021-01-17 13:04

This is probably really easy but I can\'t seem to figure out how to print/echo a class so I can find out some details about it.

I know this doesn\'t work, but this i

5条回答
  •  广开言路
    2021-01-17 13:52

    You can use Symfony VarDumper Component http://symfony.com/doc/current/components/var_dumper/introduction.html:

    Install it via Composer:

    composer require symfony/var-dumper 
    

    Usage:

    require __DIR__.'/vendor/autoload.php';
    
    // create a variable, which could be anything!
    $someVar = ...;
    
    dump($someVar);
    

提交回复
热议问题