Fandom

ProgrammingWiki

PHP Javascript

123pages on
this wiki
Add New Page
Talk0 Share
Programmer's Wiki
This page has been moved to the Programmer's Wiki.
Please do not make any changes or additions to this page.

Any modifications, if still appropriate, should be made on PHP Javascript at the Programmer's Wiki.

This scratchpad is intended for preparing a JavaScript library which mimics the API of PHP. This is intended to make it easier for PHP developers to use just one familiar API for functions (albeit relying on JavaScript syntax).

The functions may not mirror the exact behavior as found in PHP--either due to insurmountable differences with JavaScript or due to not having been adequately programmed yet (though please help to improve this).

By relying on the PHP interface, we avoid developing yet another library whose API might be too subject to change (though we could update with new versions of PHP). We will only use PHP names, except where an existing JavaScript function of the same name already exists (e.g., "eval"), in which case we will prepend "php_" to the function name.

For I/O and other privileged functions, we could either use Mozilla Javascript and XPCOM and/or Server-side JavaScript (SSJS).

Perhaps an ideal future ambition for the project would be to see some high bandwidth site to host the library (e.g., as Yahoo has done with its AJAX library) so that it could be frequently used and cached by others without fear of the library modules (depending on which set(s) were chosen) taking up too much memory to be useful.

We might also work to add within the PHP section of this Programming wiki, a PHP library to mimic the function/objects/methods/properties of Javascript, prepending "js" and capitalizing the next word (in Javascript style)--e.g., jsEval to avoid conflicts with the PHP function of the name, "eval".

Function librariesEdit

Array FunctionsEdit

Cross-reference between Javascript functions and equivalent PHP/PHP-Javascript functions (if any)Edit

Sorted by JavascriptEdit

Javascript PHP/PHP-Javascript equivalent
Array.concat() array_merge()
Array.join() implode()
Array.pop() array_pop()
Array.push() array_push()
Array.reverse() array_reverse()
Array.shift() array_shift()
Array.slice() array_slice()
Array.sort() sort()
Array.unshift() array_unshift()

Sorted by PHP-JavascriptEdit

PHP/PHP-Javascript equivalent Javascript
array_merge() Array.concat()
array_pop() Array.pop()
array_push() Array.push()
array_reverse() Array.reverse()
array_shift() Array.shift()
array_slice() Array.slice()
array_unshift() Array.unshift()
implode() Array.join()
sort() Array.sort()

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.