3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ini = <<<INI TPL_CONTACT_MISC="Miscellaneous Info" date.timezone = Pacific/Tahiti TPL_CONTACT_MISC="Your german misc info translation" COM_TODO_ALIGN="Image Float" JOOMLA! DEFAULT IMAGES=Жуумла! үндсэн зурагнууд COM_TODO_ALIGN_DESC="This will apply the classes 'pull-left', 'pull-center' or 'pull-right' to the '<figure>' or '<img>' element" COM_TODO_BROWSE_FILES="Browse files" COM_TODO_CAPTION="Caption" BAD_DOUBLE_QUOTING="quote in " the middle" WELL_ESCAPED_DOUBLE_QUOTE="this is \" okay" COM_TODO_CAPTION_CLASS_LABEL="Caption Class" COM_MEMBERSHIPS_FIELD_MEMBERSHIP_LABEL 911 WARNING_TEXT="<span class=\"red\">Warning!</span>" COM_FRED_GREETING='Hello' COM_FRED_GREETING_BARNEY='Yo, Buddy' DR_SOLD="SOLD" upload_tmp_dir = /var/www/html/tmp INI; $anomalies = []; $result = []; foreach (explode(PHP_EOL, $ini) as $i => $line) { $parsed = @parse_ini_string($line); if (!is_array($parsed)) { $anomalies[] = "Invalid character(s) @ line index $i: $line"; continue; } $key = key($parsed); if ($key === null) { $anomalies[] = "No valid declaration @ line index $i: $line"; } elseif (!mb_check_encoding($key, 'ASCII')) { $anomalies[] = "Non-ASCII character found in key @ line index $i: $line"; } elseif (!preg_match('/^[A-Z\d_-]+/', $key)) { $anomalies[] = "Key is expected to contain only uppercase letters, numbers, underscores, and hyphens @ line index $i: $line"; } elseif (!preg_match('/^[A-Z\d_-]+="(.*)"$/', $line, $m)) { $anomalies[] = "Value not wrapped in double quotes @ line index $i: $line"; } elseif (preg_match('/(?<!\\\\)(?:\\\\\\\\)*"/', $m[1])) { $anomalies[] = "Value contains unescaped double quote @ line index $i: $line"; } elseif (key_exists($key, $result)) { $anomalies[] = "Redundant key declaration @ line index $i: $key => $result[$key] **overwritten by** $parsed[$key]"; $result[$key] = $parsed[$key]; // mimic Joomla parser behaviour } else { $result[$key] = $parsed[$key]; } } var_export($anomalies); echo "\n---\n"; var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => 'Key is expected to contain only uppercase letters, numbers, underscores, and hyphens @ line index 1: date.timezone = Pacific/Tahiti', 1 => 'Redundant key declaration @ line index 2: TPL_CONTACT_MISC => Miscellaneous Info **overwritten by** Your german misc info translation', 2 => 'Invalid character(s) @ line index 4: JOOMLA! DEFAULT IMAGES=Жуумла! үндсэн зурагнууд', 3 => 'Invalid character(s) @ line index 8: BAD_DOUBLE_QUOTING="quote in " the middle"', 4 => 'No valid declaration @ line index 11: COM_MEMBERSHIPS_FIELD_MEMBERSHIP_LABEL 911', 5 => 'Value not wrapped in double quotes @ line index 13: COM_FRED_GREETING=\'Hello\'', 6 => 'Value not wrapped in double quotes @ line index 14: COM_FRED_GREETING_BARNEY=\'Yo, Buddy\'', 7 => 'Key is expected to contain only uppercase letters, numbers, underscores, and hyphens @ line index 16: upload_tmp_dir = /var/www/html/tmp', ) --- array ( 'TPL_CONTACT_MISC' => 'Your german misc info translation', 'COM_TODO_ALIGN' => 'Image Float', 'COM_TODO_ALIGN_DESC' => 'This will apply the classes \'pull-left\', \'pull-center\' or \'pull-right\' to the \'<figure>\' or \'<img>\' element', 'COM_TODO_BROWSE_FILES' => 'Browse files', 'COM_TODO_CAPTION' => 'Caption', 'WELL_ESCAPED_DOUBLE_QUOTE' => 'this is " okay', 'COM_TODO_CAPTION_CLASS_LABEL' => 'Caption Class', 'WARNING_TEXT' => '<span class="red">Warning!</span>', 'DR_SOLD' => 'SOLD', )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
60.98 ms | 409 KiB | 5 Q