Created
September 23, 2014 02:55
-
-
Save formigarafa/8a4bdae0eceb85a66789 to your computer and use it in GitHub Desktop.
dúvida de matemática binária
This file contains hidden or 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 | |
$list_to_check = array( | |
array(2,2), | |
array(2,3), | |
array(3,3), | |
array(3,2) | |
); | |
// var_dump($list_to_check); | |
function condition($pair) { | |
$x = $pair[0]; | |
$y = $pair[1]; | |
return $x == $y + 1; | |
} | |
$condition = 'condition'; | |
$result = array_filter( $list_to_check, $condition ); | |
var_dump($result); | |
// array(1) { | |
// [3]=> | |
// array(2) { | |
// [0]=> | |
// int(3) | |
// [1]=> | |
// int(2) | |
// } | |
// } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment