<?php
// http://gathering.tweakers.net/forum/list_message/41881215#41881215
function foo($string1, $string2)
{
/*
Retourneert true dan en slechts dan
wanneer de twee argumenten strings zijn
en het eerste argument lexicografisch kleiner is.
*/
return stcmp($string1, $string2);
return is_string($string1) && is_string($string2) && $string1 < $string2;
}
var_dump(
foo(1,2),
foo('1','2'),
foo('a','b'),
foo('b','a'),
foo('ab','ab'),
foo('abc','ab'),
foo('2xx','2yy')
);
Fatal error: Uncaught Error: Call to undefined function stcmp() in /in/JvbvY:12
Stack trace:
#0 /in/JvbvY(17): foo(1, 2)
#1 {main}
thrown in /in/JvbvY on line 12
Process exited with code 255.