It’d be nice if PHP had a quick Or-Equals expression like Ruby: user ||= User.new but we make do with few slightly less sugary idioms. The standard way if (isset($user)) { $user = new User(); } A bit shorter $user = isset($user) ? $user : new User(); Shorter still This is my preferred way of… Continue reading Assigning variable defaults in PHP