Javascript альтернативы php функций.
Нашел файл - библиотеку функций, альтернатив php’шным на javascript’е. От элементарных вроде strtolower до адских вроде soundex:
function soundex( str ) {
// http://kevin.vanzonneveld.net
// + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com)
// * example 1: soundex('Kevin');
// * returns 1: 'K150'
var i, j, l, r, p = isNaN(p) ? 4 : p > 10 ? 10 : p < 4 ? 4 : p,
m = {BFPV: 1, CGJKQSXZ: 2, DT: 3, L: 4, MN: 5, R: 6},
r = (s = str.toUpperCase().replace(/[^A-Z]/g, "").split("")).splice(0, 1);
for(i = -1, l = s.length; ++i < l;){
for(j in m){
if(j.indexOf(s[i]) + 1 && r[r.length-1] != m[j] && r.push(m[j])){
break;
}
}
}
return r.length > p && (r.length = p), r.join("") + (new Array(p - r.length + 1)).join("0");
}
Полный список:
- addslashes
- array_chunk
- array_combine
- array_diff
- array_diff_assoc
- array_key_exists
- array_pop
- array_push
- array_search
- array_shift
- array_sum
- array_unique
- array_unshift
- base64_decode
- base64_encode
- basename
- checkdate
- chr
- count
- crc32
- date
- empty
- end
- explode
- function_exists
- htmlentities
- implode
- include
- include_once
- in_array
- is_array
- is_numeric
- levenshtein
- ltrim
- md5
- nl2br
- number_format
- ord
- printf
- rand
- reset
- rtrim
- soundex
- sprintf
- stripslashes
- strip_tags
- strlen
- strpos
- strrpos
- strtolower
- strtoupper
- str_pad
- str_repeat
- str_replace
- str_rot13
- trim
- ucfirst
- ucwords
- utf8_decode
- utf8_encode
- wordwrap
Я постоянно что-нибудь такое в гугле ищу, может и вам пригодится.
