Skip to content

Instantly share code, notes, and snippets.

@danilovazb
Created January 13, 2015 13:38
Show Gist options
  • Save danilovazb/0fe419bd46451ab55a7b to your computer and use it in GitHub Desktop.
Save danilovazb/0fe419bd46451ab55a7b to your computer and use it in GitHub Desktop.
<?php
function compare_array($array1, $array2) {
$compare = array_diff($array1, $array2);
return (empty($compare)) ? '1' : '0';
}
function create_array() {
for($i = 0; $i < 3; $i++) {
for($j = 'A'; $j <= 'J'; $j++) {
for($k = 0; $k < 10; $k++) {
$array[$i][$j][$k] = rand(1,5);
}
}
}
return $array;
}
function search_equal($array, $char, $numero) {
for($x='0';$x<'3';$x++)
{
for($i = 'A'; $i <= 'J'; $i++) {
if($i == $char && $x != $numero) {
if( compare_array($array["$x"]["$i"], $array["$numero"]["$char"]) == 1)
echo "a letra $i do array $x = a letra $char do array $numero\n\n";
}
}
}
}
$var = create_array();
for($x='0';$x<'3';$x++)
{
search_equal($var, 'A', $x);
}
print_r($var);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment