Вопрос

While browsing the code of an open source PHP library I spotted this line:

$path = $path ?: $this->guessPackagePath();

This is not the ternary operator like it usually apprears. Would anyone explain what is going on in it?

Это было полезно?

Решение

It's a shortcut for

$path = $path ? $path : $this->guessPackagePath();

which comes from PHP 5.3

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top