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 | |
public static function sendMessage($sMessage){ | |
$webhookurl = 'https://hooks.slack.com/services/WEBHOOK'; | |
$timestamp = date("c", strtotime("now")); | |
$json_data = json_encode([ | |
// Message | |
"text" => $sMessage |
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 | |
var_dump(6.674_083e-11); // large float | |
var_dump(299_792_458.545_456); // petit float | |
var_dump(10_000_000); // entier | |
var_dump(0xCAFE_F00D); // hexa-décimale | |
var_dump(0b0101_1111); // binaire | |
/*Résultat | |
float(6.674083E-11) | |
float(299792458.54546) |
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 | |
$aProduitsExportes = ['pomme', 'poire']; | |
$aFruits = ['banane', 'pasteque', ...$aProduitsExportes, 'kiwi']; | |
print_r($aFruits); | |
/* Resultat | |
Array | |
( | |
[0] => banane |
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 | |
$_POST['ville'] = $_POST['ville'] ?? 'Lyon'; | |
echo $_POST['ville'] . "\n"; | |
$_POST['ville'] ??= 'Lyon'; | |
echo $_POST['ville'] . "\n"; | |
// Equivalent de |
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 Voiture {} | |
class Sport extends Voiture {} | |
class Consommateur { | |
public function achat(): Voiture {} | |
} | |
class Sportif extends Consommateur { | |
public function achat(): Sport {} | |
} |
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 | |
//Ancienne version de PHP | |
$nPiOld = 3.141; | |
$nValeursPiOld = array_map(function($nValeurOld) use($nPiOld){ | |
return $nValeurOld * $nPiOld; | |
}, range(1,5)); | |
print_r($nValeursPiOld); | |
// PHP 7.4 | |
$nPiNew = 3.141; |
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 Utilisateur { | |
public int $nId; | |
public string $sNom; | |
} | |
$oUtilisateur = new Utilisateur(); | |
//Fonctionne | |
$oUtilisateur->nId = 1; |
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
UPDATE wp_options SET option_value = REPLACE(option_value, 'http://localhost', 'http://192.168.1.18') WHERE option_name = 'home' OR option_name = 'siteurl'; | |
UPDATE wp_posts SET post_content = REPLACE (post_content, 'http://localhost', 'http://192.168.1.18'); | |
UPDATE wp_posts SET post_excerpt = REPLACE (post_excerpt, 'http://localhost', 'http://192.168.1.18'); | |
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, 'http://localhost','http://192.168.1.18'); | |
UPDATE wp_comments SET comment_content = REPLACE (comment_content, 'http://localhost', 'http://192.168.1.18'); | |
UPDATE wp_comments SET comment_author_url = REPLACE (comment_author_url, 'http://localhost','http://192.168.1.18'); | |
UPDATE wp_posts SET guid = REPLACE (guid, 'http://localhost', 'http://192.168.1.18'); |
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
#!/usr/bin/env python | |
import RPi.GPIO as GPIO | |
import SimpleMFRC522 | |
reader = SimpleMFRC522.SimpleMFRC522() | |
try: | |
text = raw_input('New data:') | |
print("Now place your tag to write") |
NewerOlder