Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

better alternative to print_r? #9

Open
brianium opened this issue Feb 11, 2015 · 2 comments
Open

better alternative to print_r? #9

brianium opened this issue Feb 11, 2015 · 2 comments

Comments

@brianium
Copy link
Member

The Formatter class uses print_r($var, true) to format an object by default.

This works most of the time, but will result in an endless stream of garbage if the variable contains circular references.

The symfony VarDumper component looks pretty promising. Seems like it allows you to limit depth.

@brianium
Copy link
Member Author

This could even be an additional formatter that can be used in place of the default one.

@mallorydxw
Copy link
Contributor

Another problem with print_r is that it doesn't differentiate types at all.

This code:

expect(1)->to->equal(1.0);

Produces this output:

Expected 1 to be identical to 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants