UNPKG

php.js

Version:

Use phpjs functions as required.

22 lines (18 loc) 526 B
module.exports=function(){ return strcasecmp.apply(exports,arguments) }; function strcasecmp(f_string1, f_string2) { // discuss at: http://phpjs.org/functions/strcasecmp/ // original by: Martijn Wieringa // bugfixed by: Onno Marsman // example 1: strcasecmp('Hello', 'hello'); // returns 1: 0 var string1 = (f_string1 + '') .toLowerCase(); var string2 = (f_string2 + '') .toLowerCase(); if (string1 > string2) { return 1; } else if (string1 == string2) { return 0; } return -1; }