php.js
Version:
Use phpjs functions as required.
15 lines (13 loc) • 511 B
JavaScript
module.exports=function(){ return strcmp.apply(exports,arguments) };
function strcmp(str1, str2) {
// discuss at: http://phpjs.org/functions/strcmp/
// original by: Waldo Malqui Silva
// input by: Steve Hilder
// improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// revised by: gorthaur
// example 1: strcmp( 'waldo', 'owald' );
// returns 1: 1
// example 2: strcmp( 'owald', 'waldo' );
// returns 2: -1
return ((str1 == str2) ? 0 : ((str1 > str2) ? 1 : -1));
}