DEV Community

Discussion on: Simple PHP Control Structure Refactoring

Collapse
 
poldiwa profile image
Paul John Diwa

also an alternative, based on the given example.

$url = '/default.jpg';

if ($user->avatarUrl) {
  $url = $user->avatarUrl;
}