compare($e1, $e2) == 0;
$oj = false;
}
return $ok || $e1 == $e2 || strcasecmp(trim($e1), trim($e2)) == 0;
}
function array_compare(&$ar1, &$ar2) {
if (gettype($ar1) != 'array' || gettype($ar2) != 'array') return FALSE;
if (count($ar1) != count($ar2)) return FALSE;
foreach ($ar1 as $k => $v) {
if (!array_key_exists($k,$ar2)) return FALSE;
if (!compare($v,$ar2[$k])) return FALSE;
}
return TRUE;
}
function object_compare(&$obj1, &$obj2) {
if (gettype($obj1) != 'object' || gettype($obj2) != 'object') return FALSE;
// if (class_name(obj1) != class_name(obj2)) return FALSE;
$ar1 = (array)$obj1;
$ar2 = (array)$obj2;
return array_compare($ar1,$ar2);
}
function compare(&$x,&$y) {
$ok = 0;
$x_type = gettype($x);
$y_type = gettype($y);
if ($x_type == $y_type) {
if ($x_type == "array") {
$ok = array_compare($x, $y);
} else if ($x_type == "object") {
$ok = object_compare($x, $y);
} else if ($x_type == "double") {
$ok = number_compare($x, $y);
// } else if ($x_type == 'boolean') {
// $ok = boolean_compare($x, $y);
} else {
$ok = ($x == $y);
// $ok = string_compare($expect, $result);
}
}
return $ok;
}
function parseMessage($msg)
{
# strip line endings
#$msg = preg_replace('/\r|\n/', ' ', $msg);
$response = new SOAP_Parser($msg);
if ($response->fault) {
return $response->fault->getFault();
}
$return = $response->getResponse();
$v = $response->decode($return);
if (gettype($v) == 'array' && count($v)==1) {
return array_shift($v);
}
return $v;
}
function var_dump_str($var) {
ob_start();
var_dump($var);
$res = ob_get_contents();
ob_end_clean();
return $res;
}
?>