WHAT IS return ($x > $y)? 1:-1 IN BELOW PROGRAM

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

pankajdurve
New php-forum User
New php-forum User
Posts: 2
Joined: Mon Dec 09, 2013 8:28 pm

WHAT IS return ($x > $y)? 1:-1 IN BELOW PROGRAM

Postby pankajdurve » Mon Dec 09, 2013 8:38 pm

<?php
function user_key_compare_func($x, $y)
{
if ($x === $y)
{
return 0;
}
return ($x > $y)? 1:-1;
}
$array1 = array('Math'=>77, 20, 'Geography'=>89, 30, 'Language'=>67);
$array2 = array('Math'=>77, 'science'=>91 ,20, 'History'=>71);
$diff_result = array_diff_uassoc($array1, $array2, "user_key_compare_func");
print_r($diff_result);
?>


I UNDERSTOOD ABOVE PROGRAM..BUT I AM GETTING MEANING OF return ($x > $y)? 1:-1; PLEASE ANY ONE TELL ME.

Return to “PHP coding => General”

Who is online

Users browsing this forum: No registered users and 2 guests