The Canadian @statamic Gentleman™. Vim nut. Bluffing musician. Go Saints. Go Jays. Go Habs. Husband & proud father. Love because he first loved us. 1 John 4:19.
functionalphabetPositions($string){returncollect(str_split($string))->map(function($letter){returncollect(range('a','z'))->flip()->get(strtolower($letter));})->filter()->map(function($key){return$key+1;})->implode(' ');}echoalphabetPositions("The sunset sets at twelve o' clock.");
Will be cleaner when PHP gets shorthand arrow functions, which I believe are coming in 7.4 😍 ...
functionalphabetPositions($string){returncollect(str_split($string))->map(fn($letter)=>collect(range('a','z'))->flip()->get(strtolower($letter)))->filter()->map(fn($key)=>$key+1)->implode(' ');}echoalphabetPositions("The sunset sets at twelve o' clock.");
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
In PHP using Laravel's Collection pipeline...
Will be cleaner when PHP gets shorthand arrow functions, which I believe are coming in 7.4 😍 ...