[Off topic] PHP syntax is (version && context) dependent
PHP accepts or rejects certain syntax depending on the context.
Let's hope you never have to deal with things like this.
Note: I use CakePHP.
Take this array declaration, designed to be the 2nd param in a
call to filter_var() or filter_var_array():
$options = array
'filter' => FILTER_SANITIZE_STRING,
'flags' => FILTER_FLAG_NO_ENCODE_QUOTES
If you use this in the body or in a function in a simple program,
it works under PHP V 5.5.9 and 5.6.30.
If you use it in a function within a class it works under the same
But if you declare it as a private variable at the head of a class,
it works under V 5.6.30 but triggers a syntax error under V 5.5.9,
at the first '|' char.
I've been thru all the changelogs between those 2 versions and I
did not see anything which alerted me this type of issue.
I have a giant array declaration, over 400 lines long, indexed by
$controller_name and then by $action_name, to help validate each
form for each controller. My solution for V 5.5.9 was to shift the
declaration into the function it's used within. Now the code run
under both versions.
Anyone see anything similar?
BTW: Statements of how appalling PHP's design is are all redundant, I assure you.