Last active
June 26, 2021 20:21
-
-
Save crazyyy/e84e5c0b1327a90695b3e13fff289aab to your computer and use it in GitHub Desktop.
🤸 #php Favorite Snippets
$serialized = json_encode($data, JSON_PRETTY_PRINT);
// Save the serialized array to a text file.
file_put_contents( WP_CONTENT_DIR . '/logs/data.json', $serialized);
function php_logger( $data ) {
$output = $data;
if ( is_array( $output ) )
$output = implode( ',', $output );
// print the result into the JavaScript console
echo "<script>console.log( 'PHP LOG: " . $output . "' );</script>";
}
var_dump(php_ini_loaded_file(), php_ini_scanned_files());
php_info();
echo '<table><tr><td><pre>';
var_dump($the_query->posts);
echo '</pre></td><td><pre>';
print_r($the_query);
echo '</pre></td></tr></table>';
ob_start();
var_dump($form);
$content = ob_get_clean();
file_put_contents(__FILE__.spl_object_hash($this), $content);
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment