for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Sergiors\Functional;
/**
* @author Sérgio Rafael Siqueira <[email protected]>
*
* @param mixed $ls
* @return mixed
*/
function head($ls)
{
if ([] === $ls
|| '' === $ls
|| null === $ls
) {
return false;
}
if (is_string($ls) && isset($ls[0])) {
return $ls[0];
return array_shift($ls);