<commit_before>---
layout: page
title: "About php.js"
date: 2012-09-26 17:18
comments: true
sharing: false
footer: true
alias:
- /pages/contact
---

php.js is a resource that offers community built javascript alternatives for php functions.

If you want to perform high-level operations on javascript platforms such as webbrowsers, node.js, etc, 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(), date(), md5().

PHP is a language with many high-level functions and while they're not always implemented as consistently as we'd like (mostly because they mimic their underlying C parts), it has a huge following familiar with its syntax so it makes sense to pick its API as a reference. Eliminating the need for our own documentation, thus making life easier, we hope.

We recognize JS - on the other hand - has beautiful language features, and we encourage you to learn them. Never let php.js be an excuse not to.
For the same reason, we're not porting entire language or control structures of PHP; we stick with the functions.

That said, we think of it as a challenge to port everything and decided to also port low-level PHP functions like strpos even though it may have a JavaScript counterpart (String.indexOf).
Cause besides the intellectual challenge for us, porting more also opens up php.js to all kinds of thought excercises and study purposes.
And so we see ourselves as a big resource and leave it up to the developer to decide what makes sense to take from it.
And what not.

<!--
The History of php.js
<commit_msg>Some light language clean-up of About page (and remove md5() reference since not working well)<commit_after>---
layout: page
title: "About php.js"
date: 2012-09-26 17:18
comments: true
sharing: false
footer: true
alias:
- /pages/contact
---

php.js is a resource that offers community-built JavaScript alternatives for PHP functions.

If you want to perform high-level operations on JavaScript platforms such as webbrowsers, node.js, etc, 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(), or date().

PHP is a language with many high-level functions and while they're not always implemented as consistently as we'd like (mostly because they mimic their underlying C parts), it has a huge following familiar with its syntax so it makes sense to pick its API as a reference, and in the process, eliminating the need for our own documentation, thus making life easier, we hope.

We recognize JS - on the other hand - has beautiful language features, and we encourage you to learn them. Never let php.js be an excuse not to.
For the same reason, we're not porting entire language or control structures of PHP; we stick with the functions.

That said, we think of it as a challenge to port everything and decided to also port low-level PHP functions like strpos even though it may have a close JavaScript counterpart (String.indexOf).
Besides the intellectual challenge for ourselves, porting also opens up php.js to all kinds of thought excercises and study purposes.
And so we see ourselves as a big resource and leave it up to the developer to decide when it makes sense for them to take from it.
And when not.

<!--
The History of php.js

{'fraction_non_alphanumeric': 0.05258545135845749, 'fraction_numerical': 0.007595676307332749, 'mean_word_length': 4.341653666146646, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5921516', 'n_tokens_mistral': 864, 'n_tokens_neox': 811, 'n_words': 543}