Ceci est une ancienne révision du document !
PHP
Les chaînes de caractères
Une chaîne déclarée en multilignes
$body = <<< 'EOF'
<p>You have been redirected here by default.
You are most probably using the default CAS configuration.</p>
<p>The default CAS bundle configuration should be installed in
<code>config/packages/dev/cas_bundle.yaml
</p>
<p>Please update your configuration and replace <code>cas_bundle_homepage</code> with an existing route of your app.</p> EOF;
</code>
Les tableaux
Vérifier si un tableau est associatif
function isAssoc(array $array): bool
{
if (array() === $array) return false;
return array_keys($array) !== range(0, count($array) - 1);
}
Les dates
Le format par défaut
'Y-m-d\\TH:i:sP'
Exemple
$dateStr = '1979-09-05T11:27:04+02:00';
$date = DateTime::createFromFormat('Y-m-d\\TH:i:sP', $dateStr);