ok
let say i have 11 variables with different values.
now i want every variable not to equal another variable from those variables.
example:
i have $m1, $m2, $m3...$m11
ok.. now i dont want $m1!=$m3 and $m2!=$m1 and so on
i hope u know wut i mean.
what is the easiest way to do it?
what is the Easiest way to do this??
Moderator: General Moderators
-
niceguyeddie
- Forum Newbie
- Posts: 13
- Joined: Fri Nov 28, 2003 7:12 am
- Location: Westminster, MD
Easiest would be to use one array and then call array_unique(); if I understand what you mean.
http://www.php.net/manual/en/function.array-unique.php
http://www.php.net/manual/en/function.array-unique.php
Thank u for ur help
they array_unque is not what i was looking for..
but i found it anyway thnx....
i didt a
they array_unque is not what i was looking for..
but i found it anyway thnx....
i didt a
Code: Select all
<?php
if (max($arr) == min($arr))
{
echo "variables match";
}
?>Code: Select all
<?php
<?
$m1 = 1;
$m2 = 2;
$m3 = 3;
$m4 = 4;
$m5 = 5;
$m6 = 6;
$m7 = 7;
$m8 = 8;
$m9 = 9;
$m10 = 10;
$m11 = 11;
$numbers = array($m1, $m2, $m3, $m4, $m5, $m6, $m7, $m8, $m9, $m10, $m11);
foreach ($numbers as $compare)
{
echo "Value: $compare\n";
if ( $m1 !== $compare)
{
echo " $m1 and $compare are not the same\n";
}
else
{
echo "$m1 and $compare are the same\n";
}
echo "Value: $compare\n";
if ( $m2 !== $compare)
{
echo " $m2 and $compare are not the same\n";
}
else
{
echo "$m2 and $compare are the same\n";
}
echo "Value: $compare\n";
if ( $m3 !== $compare)
{
echo " $m3 and $compare are not the same\n";
}
else
{
echo "$m3 and $compare are the same\n";
}
echo "Value: $compare\n";
if ( $m4 !== $compare)
{
echo " $m4 and $compare are not the same\n";
}
else
{
echo "$m4 and $compare are the same\n";
}
}
?>
?>thnx in advance.