a-ok Posted February 14, 2019 Posted February 14, 2019 Is it possible to output an array within a log? I'm currently doing: wire('log')->save("shopify", "collections = $collections"); Which obviously just outputs 'Array' and I tried doing: wire('log')->save("shopify", "collections = " . print_r($collections)); But this doesn't seem to do anything (or there's an error and skips it completely). Any thoughts?
Autofahrn Posted February 14, 2019 Posted February 14, 2019 wire('log')->save("shopify", "collections = " . print_r($collections, true)); You missed the second parameter of print_r which instructs to use the return value rathern than echoing. http://php.net/manual/de/function.print-r.php 4
a-ok Posted February 14, 2019 Author Posted February 14, 2019 17 minutes ago, Autofahrn said: wire('log')->save("shopify", "collections = " . print_r($collections, true)); You missed the second parameter of print_r which instructs to use the return value rathern than echoing. http://php.net/manual/de/function.print-r.php Thanks! I ended up going with `json_encode()` which seems nice too.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now