Skip to content

Instantly share code, notes, and snippets.

@tim-cotten
Created March 5, 2021 12:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tim-cotten/d890d58660872f7fb15428fad650d2af to your computer and use it in GitHub Desktop.
Save tim-cotten/d890d58660872f7fb15428fad650d2af to your computer and use it in GitHub Desktop.
PHP Bugs: Arrays Don't Like Undefined Offsets (Example B)
<?php
function startElement($name) {
global $n, $data_array, $message_type;
if (in_array($name, $message_type)) {
$data_array[$n] = "{$name}||";
} else {
$data_array[$n] = (!empty($data_array[$n]) ? $data_array[$n] : '') . "[{$name}||";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment