UNPKG

phpjs

Version:

php.js offers community built php functions in javascript

13 lines (12 loc) 458 B
function strcmp(str1, str2) { // From: http://phpjs.org/functions // + 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)); }