Questions tagged [phpjs]

Open source library which brings much of the PHP function API to JavaScript

php.js is a dual-licensed JavaScript library (MIT or GPL) which brings parts of the large PHP function library to JavaScript with the aim of providing commonly needed utilities and a familiar syntax to PHP developers.

The tag might also be used for anyone seeking to implement PHP functions or features in JavaScript regardless of whether the library currently has such an implementation.

35 questions
0
votes
2 answers

remove quotes from variable in javascript?

I really don't understand Javascript. In PHP, I can remove quotes like this: $tags_array = preg_replace('/"/', '', $tags_array); How do I write it in Javascript?
ajsie
  • 77,632
  • 106
  • 276
  • 381
0
votes
3 answers

Bogus char in Javascript testcase: all breaks

I'm using a JavaScript library called phpjs The goal is to create functions that mimic how PHP handles them. Here's one function in particular: http://phpjs.org/functions/is_float:442 I've written a couple of test-cases and all is as expected.…
KdgDev
  • 14,299
  • 46
  • 120
  • 156
0
votes
1 answer

PHP.js unserialize() error IE7

I try to serialize object data to be saved into a file by php using serialize package by PHP.js. Chrome: fine FF: fine IE9: fine IE9 in compatibility mode (essentially IE7): not fine. Error from console: SCRIPT5022: Exception thrown and not caught…
Simon Josef Kok
  • 745
  • 1
  • 8
  • 22
0
votes
1 answer

PHPJS' array_diff returns undefined

Example: http://jsfiddle.net/7Cwbn/60/ I'm trying to use array_diff function from PHPJS to check if all of the elements inside selectedFeatures are found inside elem.features, but instead I receive undefined. What…
Bob
  • 1,355
  • 5
  • 19
  • 38
0
votes
2 answers

Equivalent of array_unique and preg_split PREG_SPLIT_NO_EMPTY

I'm looking for the exact Javascript equivalent of php: $tags = preg_split('/+/', $_GET['q'], NULL, PREG_SPLIT_NO_EMPTY); $p = array_unique(array_map('strtolower', $tags)); sort($p); It's almost done var queryString =…
user1125394
1 2
3