The following code is from Symfony 2, input string 'folder/file.exe', will output 'file.exe'.
protected function getName($name)
{
$originalName = str_replace('\\', '/', $name);
$pos = strrpos($originalName, '/');
$originalName = false === $pos ? $originalName : substr($originalName, $pos + 1);
return $originalName;
}
However, I can understand everything but the following code structure:
$var = false === 'something';
Can anyone explain this to me? Thanks!
Edit:Thanks all for helping me, maybe the following code is more clear than the above code:
$originalName = ((false === $pos) ? $originalName : substr($originalName, $pos + 1));