This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Palindrome | |
{ | |
public static function isPalindrome($word) | |
{ | |
$word = strtolower($word); | |
if ( $word == strrev($word) ) { | |
return true; | |
} | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Pipeline | |
{ | |
public static function make_pipeline(...$funcs) | |
{ | |
return function($arg) use ($funcs) | |
{ | |
$result = $arg; | |
foreach ($funcs as $func) { | |
$result = $func($arg); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT COUNT(*) FROM `students` WHERE `firstname` = "John"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT t1.`name` FROM `employees` AS t1 WHERE `managerId` IS NOT NULL | |
AND t1.`id` NOT IN (SELECT `managerId` FROM `employees` WHERE `managerId` IS NOT NULL) | |
UNION | |
SELECT t1.`name` FROM `employees` AS t1 WHERE `managerId` IS NULL | |
AND t1.`id` NOT IN (SELECT `managerId` FROM `employees` WHERE `managerId` IS NOT NULL); |