3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $arrformfields[$intj][3] = 'ok'; ${$arrformfields[$intj][3]} = '1990'; $value = 'qsd;qsd'; $arrvalidrules = explode(';', $value); // On vérifie qu'il n'y bien que deux valeurs. if (count($arrvalidrules) == 2) { $arrvarlabels = array('intyearstart', 'intyearend'); foreach ($arrvarlabels as $key => $label) // On va définir l'année de départ et de fin. { if ($arrvalidrules[$key]!='') // On a définit une valeur dans la règle. { if (is_numeric($arrvalidrules[$key])) // Valeur numérique fixe. { ${$label} = intval($arrvalidrules[$key]); } else if (strpos($arrvalidrules[$key], 'Y') === 0) // Valeur selon l'année actuelle. { ${$label} = date('Y'); if (($intsignpos = strpos($arrvalidrules[$key], '+')) !== false) // On vérifie si on souhaite faire une adition. { ${$label} += intval(trim(substr($arrvalidrules[$key], $intsignpos+1))); } else if (($intsignpos = strpos($arrvalidrules[$key], '-')) !== false) // On vérifie si on souhaite faire une soustraction. { ${$label} -= intval(trim(substr($arrvalidrules[$key], $intsignpos+1))); } } else // On a saisit une valeur erroné (du texte) on définit la valeur comme par défaut. { ${$label} = ($key == 0 ? str_pad(0, ${$arrformfields[$intj][18]}, '0') : null); } } else // Définition de la valeur par défaut (annéeDeb = 0, annéeFin = null). { ${$label} = ($key == 0 ? str_pad(0, ${$arrformfields[$intj][18]}, '0') : null); } } if ($intyearend !== null) { if ( (($intyearstart > $intyearend) && (${$arrformfields[$intj][3]} < $intyearend && ${$arrformfields[$intj][3]} > $intyearstart)) OR ${$arrformfields[$intj][3]} < $intyearstart && ${$arrformfields[$intj][3]} > $intyearend ) { if ($intyearstart > $intyearend) { // L'année de début > à la fin, on change les valeurs. $intswitch = $intyearstart; $intyearstart = $intyearend; $intyearend = $intswitch; } // "Le champ '".$arrformfields[$intj][1]."' est invalide, la valeur doit être comprise entre ".$intyearstart." et ".$intyearend." !<br />"; echo "Faux\n\n"; } } } echo 'Date : '.$intyearstart.' - '.$intyearend;
Output for 7.1.0
Notice: Undefined variable: intj in /in/2mLpF on line 3 Notice: Undefined variable: intj in /in/2mLpF on line 3 Notice: Undefined variable: intj in /in/2mLpF on line 4 Notice: Undefined variable: intj in /in/2mLpF on line 37 Notice: Undefined offset: 18 in /in/2mLpF on line 37 Notice: Undefined variable: in /in/2mLpF on line 37 Date : 0 -
Output for 5.3.0 - 7.0.14
Notice: Undefined variable: intj in /in/2mLpF on line 3 Notice: Undefined variable: intj in /in/2mLpF on line 4 Notice: Undefined variable: intj in /in/2mLpF on line 37 Notice: Undefined offset: 18 in /in/2mLpF on line 37 Notice: Undefined variable: in /in/2mLpF on line 37 Date : 0 -
Output for 5.0.4 - 5.2.17
Notice: Undefined variable: intj in /in/2mLpF on line 3 Notice: Undefined variable: intj in /in/2mLpF on line 4 Notice: Undefined variable: intj in /in/2mLpF on line 37 Notice: Undefined offset: 18 in /in/2mLpF on line 37 Notice: Undefined variable: in /in/2mLpF on line 37 Date : 0 -
Output for 4.3.0 - 5.0.3
Notice: Undefined variable: intj in /in/2mLpF on line 3 Notice: Undefined variable: intj in /in/2mLpF on line 4 Notice: Undefined variable: intj in /in/2mLpF on line 37 Notice: Undefined offset: 18 in /in/2mLpF on line 37 Notice: Undefined variable: in /in/2mLpF on line 37 Date : 0 -