Skip to content

Instantly share code, notes, and snippets.

@lbvf50mobile
Last active July 28, 2020 08:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lbvf50mobile/59c4122ff36639e181ffcefdc8b9e6fa to your computer and use it in GitHub Desktop.
Save lbvf50mobile/59c4122ff36639e181ffcefdc8b9e6fa to your computer and use it in GitHub Desktop.
Just PHP FUN 061.
<?php
# https://www.codewars.com/kata/582c81d982a0a65424000201 Is every value in the array an array?
function arr_check(array $a): bool {
foreach($a as $v) if(!is_array($v)) return false;
return true;
}
<?php
# https://www.codewars.com/kata/5827acd5f524dd029d0005a4
# Coding Meetup #3 - Higher-Order Functions Series - Is Ruby coming?
function is_ruby_coming($a) {
return false !== array_search("Ruby",array_column($a,'language'));
}
<?php
# https://www.codewars.com/kata/58287977ef8d4451f90001a0
# Coding Meetup #6 - Higher-Order Functions Series - Can they code in the same language?
function is_same_language($a) {
return count(array_unique(array_column($a,'language'))) < 2;
}

Just PHP FUN 061.

Started at 13:01 at 28.07.2020 Tuesday July.
Finished at 15:37 at 28.07.2020 Tuesday July. (2hrs 36minutes)

<?php
# https://www.codewars.com/kata/579fa665bb9944f9340005d2 Rotate to the max.
function rotate_to_max($n): int {
$n = str_split(strval($n));
rsort($n);
return intval(implode($n));
}
<?php
# https://www.codewars.com/kata/55da6c52a94744b379000036 Sum up the random string.
function sum_from_string(string $str): int {
preg_match_all('/\d+/',$str,$matches);
return array_sum(array_map('intval',$matches[0]));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment