How can you easily avoid getting this error/notice:
Notice: Undefined offset: 1 in /var/www/page.php on line 149
... in this code:
list($func, $field) = array_pad(explode('|', $value, 2), 2, null);
Two changes:
explode() to 2. It seems, that no more than this is wantednull until the array contains 2 values. See Manual: array_pad() for further informationThis means, if there is no | in $value, $field === null. Of course you can use every value you like to define as default for $field (instead of null). Its also possible to swap the behavior of $func and $field
list($func, $field) = array_pad(explode('|', $value, 2), -2, null);
Now $func is null, when there is no | in $value.