简体   繁体   中英

Php exit() function print message

can you help me? I have this line:

$orderRequest = new CreateOrderRequest(null, "BTC", null, $currency, $amount, $orderDescription, "en", $callbackUrl, $successUrl, $cancelUrl);

I need to print: $orderRequest

I do it like this:

exit("orderRequest: {$currency} {$amount}; {$orderDescription}; {$callbackUrl}; {$successUrl}; {$cancelUrl}");

Maybe there is an easier way to do this?

Here's a way to simplify:

echo '<pre>'; // easy way to improve print_r layout (newlines)
print_r($orderRequest); // can print objects and arrays, while exit() doesn't
exit(); // optional, depending if you want to terminate program execution

Also, the curly braces like for {$currency} are only needed when your print an array key in a double quoted string like in echo "{$currency['key']}";

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM