Conditional object constructor for old php