php.js
php.js is an open source project that brings high-level PHP functions to low-level JavaScript platforms such as web browsers, browser extensions ( Mozilla/Firefox, Chrome ), AIR, and SSJS engines like V8 ( node.js, v8cgi ), Rhino, and SpiderMonkey ( CouchDB )
If you want to perform high-level operations on these platforms, you probably need to write JS that combines its lower-level functions and build it up until you have something useful like: strip_tags(), strtotime(), number_format(), wordwrap().
Functions overview
Here is a list of functions currently implemented by php.js. Missing functions can be found here .
Arrays
- array
- array_change_key_case
- array_chunk
- array_combine
- array_count_values
- array_diff
- array_diff_assoc
- array_diff_key
- array_diff_uassoc
- array_diff_ukey
- array_fill
- array_fill_keys
- array_filter
- array_flip
- array_intersect
- array_intersect_assoc
- array_intersect_key
- array_intersect_uassoc
- array_intersect_ukey
- array_key_exists
- array_keys
- array_map
- array_merge
- array_merge_recursive
- array_multisort
- array_pad
- array_pop
- array_product
- array_push
- array_rand
- array_reduce
- array_replace
- array_replace_recursive
- array_reverse
- array_search
- array_shift
- array_slice
- array_splice
- array_sum
- array_udiff
- array_udiff_assoc
- array_udiff_uassoc
- array_uintersect
- array_uintersect_assoc
- array_uintersect_uassoc
- array_unique
- array_unshift
- array_values
- array_walk
- array_walk_recursive
- arsort
- asort
- compact
- count
- current
- each
- end
- extract
- in_array
- key
- krsort
- ksort
- natcasesort
- natsort
- next
- pos
- prev
- range
- reset
- rsort
- shuffle
- sizeof
- sort
- uasort
- uksort
- usort
BCMath Arbitrary Precision Mathematics
Character type checking
- ctype_alnum
- ctype_alpha
- ctype_cntrl
- ctype_digit
- ctype_graph
- ctype_lower
- ctype_print
- ctype_punct
- ctype_space
- ctype_upper
- ctype_xdigit
Class/Object Information
- class_alias
- class_exists
- get_class
- get_class_methods
- get_class_vars
- get_declared_classes
- get_object_vars
- method_exists
- property_exists
Classkit
- classkit_import
- classkit_method_add
- classkit_method_copy
- classkit_method_redefine
- classkit_method_remove
- classkit_method_rename
Date and Time
- checkdate
- date
- date_default_timezone_get
- date_default_timezone_set
- date_parse
- getdate
- gettimeofday
- gmdate
- gmmktime
- gmstrftime
- idate
- localtime
- microtime
- mktime
- strftime
- strptime
- strtotime
- time
- timezone_abbreviations_list
- timezone_identifiers_list
Error Handling and Logging
Filesystem
- basename
- dirname
- fclose
- feof
- fgetc
- fgetcsv
- fgets
- fgetss
- file
- file_exists
- file_get_contents
- filemtime
- filesize
- fopen
- fpassthru
- fread
- fscanf
- fseek
- ftell
- pathinfo
- pclose
- popen
- readfile
- realpath
- rewind
Function Handling
- call_user_func
- call_user_func_array
- create_function
- forward_static_call
- forward_static_call_array
- func_get_arg
- func_get_args
- func_num_args
- function_exists
- get_defined_functions
- register_shutdown_function
JavaScript Object Notation
Language & Control Structures
Mathematical Functions
Miscellaneous Functions
- constant
- define
- defined
- die
- exit
- pack
- php_strip_whitespace
- sleep
- time_nanosleep
- time_sleep_until
- uniqid
- usleep
Net Gopher
Network
Object Aggregation/Composition
- aggregate
- aggregate_info
- aggregate_methods
- aggregate_methods_by_list
- aggregate_methods_by_regexp
- aggregate_properties
- aggregate_properties_by_list
- aggregate_properties_by_regexp
- aggregation_info
- deaggregate
PHP Options and Information
- assert
- assert_options
- get_cfg_var
- get_defined_constants
- get_extension_funcs
- get_include_path
- get_included_files
- get_required_files
- getenv
- getlastmod
- ini_alter
- ini_get
- ini_get_all
- ini_restore
- ini_set
- php_ini_loaded_file
- php_ini_scanned_files
- phpversion
- putenv
- restore_include_path
- set_include_path
- set_time_limit
- version_compare
Program execution Functions
Regular Expressions (Perl-Compatible)
Streams
- stream_context_create
- stream_context_get_default
- stream_context_get_options
- stream_context_get_params
- stream_context_set_default
- stream_context_set_option
- stream_context_set_params
- stream_get_contents
- stream_get_line
- stream_is_local
Strings
- addcslashes
- addslashes
- bin2hex
- chop
- chr
- chunk_split
- convert_cyr_string
- convert_uuencode
- count_chars
- crc32
- echo
- explode
- get_html_translation_table
- html_entity_decode
- htmlentities
- htmlspecialchars
- htmlspecialchars_decode
- implode
- join
- lcfirst
- levenshtein
- localeconv
- ltrim
- md5
- md5_file
- metaphone
- money_format
- nl2br
- nl_langinfo
- number_format
- ord
- parse_str
- printf
- quoted_printable_decode
- quoted_printable_encode
- quotemeta
- rtrim
- setlocale
- sha1
- sha1_file
- soundex
- split
- sprintf
- sscanf
- str_getcsv
- str_ireplace
- str_pad
- str_repeat
- str_replace
- str_rot13
- str_shuffle
- str_split
- str_word_count
- strcasecmp
- strchr
- strcmp
- strcoll
- strcspn
- strip_tags
- stripos
- stripslashes
- stristr
- strlen
- strnatcasecmp
- strnatcmp
- strncasecmp
- strncmp
- strpbrk
- strpos
- strrchr
- strrev
- strripos
- strrpos
- strspn
- strstr
- strtok
- strtolower
- strtoupper
- strtr
- substr
- substr_compare
- substr_count
- substr_replace
- trim
- ucfirst
- ucwords
- vprintf
- vsprintf
- wordwrap
URLs
- base64_decode
- base64_encode
- get_headers
- get_meta_tags
- http_build_query
- parse_url
- rawurldecode
- rawurlencode
- urldecode
- urlencode
Variable handling
- doubleval
- empty
- floatval
- get_defined_vars
- get_resource_type
- gettype
- import_request_variables
- intval
- is_array
- is_binary
- is_bool
- is_buffer
- is_callable
- is_double
- is_float
- is_int
- is_integer
- is_long
- is_null
- is_numeric
- is_object
- is_real
- is_resource
- is_scalar
- is_string
- is_unicode
- isset
- print_r
- serialize
- settype
- strval
- unserialize
- var_dump
- var_export
XML Parser
[internal] php.js shared libs
i18n
runkit
- runkit_class_adopt
- runkit_class_emancipate
- runkit_function_add
- runkit_function_copy
- runkit_function_redefine
- runkit_function_remove
- runkit_function_rename
- runkit_import
- runkit_method_add
- runkit_method_copy
- runkit_method_redefine
- runkit_method_remove
- runkit_method_rename
- runkit_superglobals
xdiff