将字符串与数组php进行比较

时间:2015-10-06 12:48:51

标签: arrays string compare

我做了这个功能:

 <?php
function check() {
    if ($GLOBALS['a'] == $GLOBALS['tools']) {

    echo "HETZELFDE! <br>";
   var_dump($GLOBALS['a']);
  echo "<br>";
   var_dump($GLOBALS['tools']);

}
else {

    $GLOBALS['tools'];
    echo "NIET HETZELFDE <br>";

    $GLOBALS['a'] = strtoupper(array2string($GLOBALS['a']));
    var_dump($GLOBALS['a']     );
   echo "<br>";
    //array2string($GLOBALS['a']);
    var_dump($GLOBALS['tools']     );   

}
}

check() ?>

结果是:

NIET HETZELFDE
string(63) "[0] => RED [1] => BLUE [2] => BLACK [3] => ORANGE [4] => GREEN "
string(58) "[RED] => [BLUE] => [BLACK] => [ORANGE] => [GREEN] => " 

我需要知道$ a == $ tools(如果a与工具相同)

我该怎么做呢?

0 个答案:

没有答案