0
我做了這個功能:比較一個字符串數組PHP
<?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 == $工具(如果是與工具一樣)
我該如何正確地做到這一點?