Skip to content

Instantly share code, notes, and snippets.

@mllvzeth
mllvzeth / print_r2.php
Created April 5, 2017 21:58 — forked from Shelob9/print_r2.php
Make print_r() more readable. Found on http://us2.php.net/print_r
<?php
function print_r2($val){
echo '<pre>';
print_r($val);
echo '</pre>';
}
?>
@mllvzeth
mllvzeth / print_r2.php
Created April 5, 2017 21:58 — forked from Shelob9/print_r2.php
Make print_r() more readable. Found on http://us2.php.net/print_r
<?php
function print_r2($val){
echo '<pre>';
print_r($val);
echo '</pre>';
}
?>
@mllvzeth
mllvzeth / .gitignore
Created March 30, 2017 16:22 — forked from octocat/.gitignore
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@mllvzeth
mllvzeth / gist:6e9a3f44461edb337f932ae98ee41bb5
Created March 29, 2017 21:06
Runinng process with realtime output in PHP
//*
* http://stackoverflow.com/questions/1281140/run-process-with-realtime-output-in-php
*
//
$cmd = "ping 127.0.0.1";
$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read from
1 => array("pipe", "w"), // stdout is a pipe that the child will write to
2 => array("pipe", "w") // stderr is a pipe that the child will write to
@mllvzeth
mllvzeth / prepare & execute PDO SQL INSERT with placeholders
Last active July 28, 2021 02:59
simplified automatic PDO INSERT SQL time saver ⌛ by @Rami_jamleh; with revision by @Clair_Shaw
<?php
/**
* @Rami jamleh - http://php.net/manual/en/pdostatement.execute.php#111823
* @Clair_Shaw(Revision) - http://php.net/manual/en/pdostatement.execute.php#116901
* simplified $placeholder form
**/
$data = ['a'=>'foo','b'=>'bar'];
$keys = array_keys($data);
$fields = '`'.implode('`, `',$keys).'`';
//$placeholder = substr(str_repeat('?,',count($keys),0,-1));