Well, guess what? You can be lazy about it… Simply use var_export and php will generate all the code for you to straight copy and paste.

1

var_export($complexObj);

**DISCLAIMER WARNING** This is generally a VERY bad practice. You are always suppose to create the assertions independently from what the output generates. It will be very easy to just copy and paste a mistake in the output that is not correct. Be sure if you do this that you look very carefully at the output and make sure it is exactly what it is supposed to be.