From 9c06f30873473026a837e9709d8d398662189cde Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Tue, 11 Jan 2022 10:55:09 +0800 Subject: [PATCH] output.php --- php/output.php | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 php/output.php diff --git a/php/output.php b/php/output.php new file mode 100644 index 0000000..6d25926 --- /dev/null +++ b/php/output.php @@ -0,0 +1,37 @@ +toArray(); + } + if (is_array($something)) { + $something = var_export($something, true); + } + if (empty($something)) { + $something = ''; + } + if (is_object($something)) { + if (method_exists($something, 'toArray')) { + $something = $something->toArray(); + } elseif (method_exists($something, 'jsonSerialize')) { + $something = $something->jsonSerialize(); + } else { + $something = var_export($something, true); + } + } + $result[] = $something; + } + file_put_contents( + 'test_' . date('d.m.Y') . '.log', + '[' . date('H:i:s') . '] ' . + implode(' ', $result) . PHP_EOL, + FILE_APPEND + ); +}