UNPKG

php.js

Version:

Use phpjs functions as required.

18 lines (16 loc) 615 B
module.exports=function(){ return strpbrk.apply(exports,arguments) }; function strpbrk(haystack, char_list) { // discuss at: http://phpjs.org/functions/strpbrk/ // original by: Alfonso Jimenez (http://www.alfonsojimenez.com) // bugfixed by: Onno Marsman // revised by: Christoph // improved by: Brett Zamir (http://brett-zamir.me) // example 1: strpbrk('This is a Simple text.', 'is'); // returns 1: 'is is a Simple text.' for (var i = 0, len = haystack.length; i < len; ++i) { if (char_list.indexOf(haystack.charAt(i)) >= 0) { return haystack.slice(i); } } return false; }