This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$tab = array( | |
'cle1' => 1, | |
'cle2'=> 2, | |
'cle3'=> 3 | |
); | |
$tab += array( | |
'cle2'=> 7, // ne sera pas utilisé car déja présent | |
'cle4' => 4 // sera ajouté car n'existe pas | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$a = 10+25.99+0.01; | |
echo '<br>$a = 10+25.99+0.01 = 36'; | |
echo '<br>round($a) = '.round($a); | |
echo '<br>$a - round($a) = '.($a-round($a)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$data = array(); | |
for($i = 0;$i<= 10000;$i++) { | |
$data[md5($i)] = $i; | |
} | |
$start = microtime(true); | |
foreach($data as $k => $v) { | |
$data[$k] = 'benchkmark'; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$string = "hello world"; | |
$taille = 5; | |
$t = microtime(true); | |
for($i = 0;$i<10000;$i++) { | |
if(strlen($string) >= $taille) { | |
} | |
} | |
echo '<br> strlen($string) > 5 : '.round((microtime(true)-$t)*1000,2)." ms"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class DateTimeDeluxe extends DateTime { | |
public function isFirst($daystring) { | |
return $this -> diff(new DateTime("first ".$daystring." of ".strtolower($this -> format("F")))) -> days === 0; | |
} | |
} | |
$newDate = new DateTimeDeluxe(); | |
// premier lundi du mois ? | |
var_dump($newDate -> isFirst('monday')); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$root = 'var'; | |
for($i = 0;$i <= 10; $i++) { | |
$varName = $root.$i; | |
$$varName = $i; | |
} | |
$timer = microtime(true); | |
for($j = 0;$j <= 100; $j++) { | |
$var = $var1.' qsd '.$var2.' qsd '.$var3.' qsd '.$var4.' qsd '.$var5.' qsd '.$var6.' qsd '.$var7.' qsd'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# install : | |
# curl -o installer.sh https://gist.github.com/iNem0o/6346423/raw && chmod +x installer.sh && sudo ./installer.sh | |
sudo apt-get update | |
sudo apt-get --no-install-recommends -y install git cmake libusb-1.0-0-dev libpulse-dev libx11-dev screen qt4-qmake libtool autoconf automake libfftw3-dev | |
mkdir ~/src | |
echo "Installation de rtl_sdr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ob_disable() { | |
ini_set('output_buffering', 'off'); | |
ini_set('zlib.output_compression', false); | |
ini_set('implicit_flush', true); | |
ob_implicit_flush(true); | |
while (ob_get_level() > 0) { | |
$level = ob_get_level(); | |
ob_end_clean(); | |
if (ob_get_level() == $level) break; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace inem0o\Tools; | |
/** | |
* Class HipChatNotifier | |
* Allow you to notify a room on HipChat | |
* @package inem0o\Tools | |
*/ | |
class HipChatNotifier | |
{ | |
/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class LinkCore { | |
protected function getBaseLink($args) { | |
echo '<br>LinkCore -> '.$args; | |
} | |
} | |
class Link extends LinkCore { | |
public function getBaseLink($args) { |