<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="http://wiki.edmc73.com/lib/exe/css.php?s=feed" type="text/css"?>
<rss version="2.0">
    <channel xmlns:g="http://base.google.com/ns/1.0">
        <title>EDMC73.com - devweb:php</title>
        <description></description>
        <link>http://wiki.edmc73.com/</link>
        <lastBuildDate>Tue, 02 Jun 2026 02:25:55 +0000</lastBuildDate>
        <generator>FeedCreator 1.8</generator>
        <image>
            <url>http://wiki.edmc73.com/_media/logo.png</url>
            <title>EDMC73.com</title>
            <link>http://wiki.edmc73.com/</link>
        </image>
        <item>
            <title>Array</title>
            <link>http://wiki.edmc73.com/devweb/php/array?rev=1760092731&amp;do=diff</link>
            <description>Array

Solution pour rechercher dans une liste de tableau


$tableau = [
  [
    &#039;id&#039; =&gt; &#039;a&#039;,
    &#039;nom&#039;=&gt; &#039;Alain&#039;
  ],[
    &#039;id&#039; =&gt; &#039;b&#039;,
    &#039;nom&#039;=&gt; &#039;Bénédicte&#039;
  ]
];


// ressortir le nom pour un id = &#039;b&#039;

// soit
echo $tableau[array_search(&#039;b&#039;, array_column($tableau,&#039;id&#039;))][&#039;nom&#039;];

// soit
var_dump( array_filter($tableau, fn($e)=&gt;$e[&#039;id&#039;]==&#039;b&#039;) );</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 10 Oct 2025 10:38:51 +0000</pubDate>
        </item>
        <item>
            <title>Autoload</title>
            <link>http://wiki.edmc73.com/devweb/php/autoload?rev=1447145342&amp;do=diff</link>
            <description>Autoload

Petit bout de code permettant de charger automatiquement un fichier de class lorsque l’on appelle une class qui  n’existe pas dans le code.



/**
 * Automatically includes classes
 * 
 * @throws Exception
 * 
 * @param  string $class_name  Name of the class to load
 * @return void
 */
function __autoload($class_name)
{
    // Adaptez le chemin où se situe vos class
    $class_root = $_SERVER[&#039;DOCUMENT_ROOT&#039;] . &#039;/inc/class/&#039;;
    
    $file = $class_root . $class_name . &#039;.php&#039;;

    if…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Tue, 10 Nov 2015 08:49:02 +0000</pubDate>
        </item>
        <item>
            <title>explode</title>
            <link>http://wiki.edmc73.com/devweb/php/explode?rev=1574673868&amp;do=diff</link>
            <description>explode

Pour faire un explode sur un retour chariot, la meilleur méthode est 
$skuList = preg_split(&#039;/\r\n|\r|\n/&#039;, $_POST[&#039;skuList&#039;]);</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Mon, 25 Nov 2019 09:24:28 +0000</pubDate>
        </item>
        <item>
            <title>Fichier</title>
            <link>http://wiki.edmc73.com/devweb/php/fichier?rev=1415228559&amp;do=diff</link>
            <description>Fichier

Effacer plusieurs fichiers

Faire l’équivalent en bash de
rm /tmp/toto*.txt
en php
array_map(&#039;unlink&#039;, glob(&quot;/tmp/toto*.txt&quot;));
Lister les fichiers

Permet d’avoir la liste des fichiers d’un répertoire sans les . et ..
$images = array_diff(scandir($directory), array(&#039;..&#039;, &#039;.&#039;));</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 05 Nov 2014 23:02:39 +0000</pubDate>
        </item>
        <item>
            <title>Graphiques</title>
            <link>http://wiki.edmc73.com/devweb/php/graph?rev=1384426138&amp;do=diff</link>
            <description>Graphiques

&lt;http://naku.dohcrew.com/libchart/pages/introduction/&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Thu, 14 Nov 2013 10:48:58 +0000</pubDate>
        </item>
        <item>
            <title>GUID</title>
            <link>http://wiki.edmc73.com/devweb/php/guid?rev=1505139451&amp;do=diff</link>
            <description>GUID


function getGUID(){
    if (function_exists(&#039;com_create_guid&#039;)){
        return com_create_guid();
    }else{
        mt_srand((double)microtime()*10000);//optional for php 4.2.0 and up.
        $charid = strtoupper(md5(uniqid(rand(), true)));
        $hyphen = chr(45);// &quot;-&quot;
        $uuid = chr(123)// &quot;{&quot;
            .substr($charid, 0, 8).$hyphen
            .substr($charid, 8, 4).$hyphen
            .substr($charid,12, 4).$hyphen
            .substr($charid,16, 4).$hyphen
            .…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Mon, 11 Sep 2017 14:17:31 +0000</pubDate>
        </item>
        <item>
            <title>Mysql et les timezones</title>
            <link>http://wiki.edmc73.com/devweb/php/mysql_timezone?rev=1408526623&amp;do=diff</link>
            <description>Mysql et les timezones

Voilà, au bout d’une heure de travail au bureau, je suis en mesure de transformer ce topic en mini tuto :-)

En fait, il faut savoir qu’un dossier sur les fuseaux horaires existe sur les OS Linux et MacOS par défaut, et qu</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 20 Aug 2014 09:23:43 +0000</pubDate>
        </item>
        <item>
            <title>Numéro de semaine et année</title>
            <link>http://wiki.edmc73.com/devweb/php/numero_semaine?rev=1383730279&amp;do=diff</link>
            <description>Numéro de semaine et année

Choses à faire attention quand vous utilisez les numéros de semaine avec l’année.

&lt;?php
echo date(&quot;Y-W&quot;, strtotime(&quot;2011-01-07&quot;)); // affiche 2011-01

echo date(&quot;Y-W&quot;, strtotime(&quot;2011-12-31&quot;)); // affiche 2011-52
echo date(&quot;Y-W&quot;, strtotime(&quot;2011-01-01&quot;)); // affiche 2011-52 aussi !!

echo date(&quot;Y-W&quot;, strtotime(&quot;2007-12-31&quot;)); // affiche 2007-01 : c&#039;est logiquement faux !
echo date(&quot;Y-W&quot;, strtotime(&quot;2008-01-01&quot;)); // affiche 2008-01
?&gt;</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 06 Nov 2013 09:31:19 +0000</pubDate>
        </item>
        <item>
            <title>Objet</title>
            <link>http://wiki.edmc73.com/devweb/php/object?rev=1498940217&amp;do=diff</link>
            <description>Objet

Créer un objet vide


$genericObject = new stdClass();


Créer un tableau d&#039;objet en faisant du cast


$var = array(
             (object) array(&#039;value&#039; =&gt; &#039;1&#039;,&#039;label&#039; =&gt; &#039;tata&#039;),
             (object) array(&#039;value&#039; =&gt; &#039;2&#039;,&#039;label&#039; =&gt; &#039;tete&#039;),
             (object) array(&#039;value&#039; =&gt; &#039;3&#039;,&#039;label&#039; =&gt; &#039;titi&#039;),
             (object) array(&#039;value&#039; =&gt; &#039;4&#039;,&#039;label&#039; =&gt; &#039;toto&#039;)
        );</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sat, 01 Jul 2017 20:16:57 +0000</pubDate>
        </item>
        <item>
            <title>Req to csv</title>
            <link>http://wiki.edmc73.com/devweb/php/req2csv?rev=1372864010&amp;do=diff</link>
            <description>Req to csv

Le but de ce script est de pouvoir exporter le résultat d’une requête mysql dans un fichier au format CSV avec les entêtes de colonnes.


&lt;?
/**
 * Exporter une requête mysql dans un fichier csv
 * Fait le 3-07-2013 par EDMC73
 */

// Connexion à la base de données : server, user, password, db
$db = new mysqli(&#039;localhost&#039;,&#039;root&#039;,&#039;Motdepasse&#039;,&#039;maBase&#039;);

// Séparateur de champ
$separateur=&quot;;&quot;;

// Nom du fichier de sortie
$filename=&quot;export_&quot;.date(&#039;Ymd-His&#039;).&quot;.csv&quot;;

// Requête à expor…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 03 Jul 2013 15:06:50 +0000</pubDate>
        </item>
        <item>
            <title>Slug</title>
            <link>http://wiki.edmc73.com/devweb/php/slug?rev=1428674012&amp;do=diff</link>
            <description>Slug

Php


function sluggable($str) {
    $a = array(&#039;À&#039;,&#039;Á&#039;,&#039;Â&#039;,&#039;Ã&#039;,&#039;Ä&#039;,&#039;Å&#039;,&#039;Æ&#039;,&#039;Ç&#039;,&#039;È&#039;,&#039;É&#039;,&#039;Ê&#039;,&#039;Ë&#039;,&#039;Ì&#039;,&#039;Í&#039;,&#039;Î&#039;,&#039;Ï&#039;,&#039;Ð&#039;,&#039;Ñ&#039;,&#039;Ò&#039;,&#039;Ó&#039;,&#039;Ô&#039;,&#039;Õ&#039;,&#039;Ö&#039;,&#039;Ø&#039;,&#039;Ù&#039;,&#039;Ú&#039;,&#039;Û&#039;,&#039;Ü&#039;,&#039;Ý&#039;,&#039;ß&#039;,&#039;à&#039;,&#039;á&#039;,&#039;â&#039;,&#039;ã&#039;,&#039;ä&#039;,&#039;å&#039;,&#039;æ&#039;,&#039;ç&#039;,&#039;è&#039;,&#039;é&#039;,&#039;ê&#039;,&#039;ë&#039;,&#039;ì&#039;,&#039;í&#039;,&#039;î&#039;,&#039;ï&#039;,&#039;ñ&#039;,&#039;ò&#039;,&#039;ó&#039;,&#039;ô&#039;,&#039;õ&#039;,&#039;ö&#039;,&#039;ø&#039;,&#039;ù&#039;,&#039;ú&#039;,&#039;û&#039;,&#039;ü&#039;,&#039;ý&#039;,&#039;ÿ&#039;,&#039;A&#039;,&#039;a&#039;,&#039;A&#039;,&#039;a&#039;,&#039;A&#039;,&#039;a&#039;,&#039;C&#039;,&#039;c&#039;,&#039;C&#039;,&#039;c&#039;,&#039;C&#039;,&#039;c&#039;,&#039;C&#039;,&#039;c&#039;,&#039;D&#039;,&#039;d&#039;,&#039;Ð&#039;,&#039;d&#039;,&#039;E&#039;,&#039;e&#039;,&#039;E&#039;,&#039;e&#039;,&#039;E&#039;,&#039;e&#039;,&#039;E&#039;,&#039;e&#039;,&#039;E&#039;,&#039;e&#039;,&#039;G&#039;,&#039;g&#039;,&#039;G&#039;,&#039;g&#039;,&#039;G&#039;,&#039;g&#039;,&#039;G&#039;,&#039;g&#039;,&#039;H&#039;,&#039;h&#039;,&#039;H&#039;,&#039;h&#039;,&#039;I&#039;,&#039;i&#039;,&#039;I&#039;,&#039;i&#039;,&#039;I&#039;,&#039;i&#039;,&#039;I&#039;,&#039;i&#039;,&#039;I&#039;,&#039;i&#039;,&#039;?&#039;,&#039;?&#039;,&#039;J…</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Fri, 10 Apr 2015 13:53:32 +0000</pubDate>
        </item>
        <item>
            <title>strtotime()</title>
            <link>http://wiki.edmc73.com/devweb/php/strtotime?rev=1391954875&amp;do=diff</link>
            <description>strtotime()

Fonction qui permet de renvoyer un time() en rentrant une date au format chaine de caractère.

Oui mais...
date(&quot;jS F, Y&quot;, strtotime(&quot;11.12.2010&quot;));
11th December, 2010date(&quot;jS F, Y&quot;, strtotime(&quot;2011.12.10&quot;));
1st January, 1970date(&quot;jS F, Y&quot;, strtotime(&quot;11/12/2010&quot;));
12th November, 2010</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Sun, 09 Feb 2014 14:07:55 +0000</pubDate>
        </item>
        <item>
            <title>Timezone</title>
            <link>http://wiki.edmc73.com/devweb/php/timezone?rev=1408524289&amp;do=diff</link>
            <description>Timezone

Admettons une date au format timestamp qui part défaut en heure UTC. On veut la convertir en heure de Paris.


// On crée un objet DateTime
$date = new DateTime();
// On définie le timestamp
$date-&gt;setTimestamp($date_timestamp);
// On peut afficher le timezone actuel
echo $date-&gt;getTimezone()-&gt;getName();
// et afficher la date et heure actuelle
echo $date-&gt;format(&#039;Y-m-d H:i:s P&#039;);
// On définie un nouveau timezone
$date-&gt;setTimezone(new DateTimeZone(&#039;Europe/Paris&#039;));
// on vérifie que …</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Wed, 20 Aug 2014 08:44:49 +0000</pubDate>
        </item>
        <item>
            <title>Majuscule au début des mots</title>
            <link>http://wiki.edmc73.com/devweb/php/ucname?rev=1415614080&amp;do=diff</link>
            <description>Majuscule au début des mots

Petite fonction permettant de mettre une majuscule sur la première lettre de chaque mot.


	function ucname($string) {
	    $string =ucwords(strtolower($string));

	    foreach (array(&#039;-&#039;) as $delimiter) {
	      if (strpos($string, $delimiter)!==false) {
	        $string =implode($delimiter, array_map(&#039;ucfirst&#039;, explode($delimiter, $string)));
	      }
	    }
	    return $string;
	}</description>
            <author>anonymous@undisclosed.example.com (Anonymous)</author>
            <pubDate>Mon, 10 Nov 2014 10:08:00 +0000</pubDate>
        </item>
    </channel>
</rss>
