Is There a PHP Sandbox, Something Like Jsfiddle Is to Js

Is there a PHP Sandbox, something like JSFiddle is to JS?

If you are just looking for an online site to play around with PHP code, try

  • http://phpfiddle.org/
  • http://ideone.com/
  • https://codeanywhere.net/
  • http://www.tehplayground.com/
  • http://sandbox.onlinephpfunctions.com/
  • http://codepad.org/
  • https://eval.in/
  • https://implode.io/ (permits attaching a version of the Laravel framework)

The most sophisticated is:

  • http://3v4l.org/

It lets you test your code in all PHP versions starting from PHP4.

If you want something for your local environment, the Runkit extension aims to provide a PHP Sandbox:

Instantiating the Runkit_Sandbox class creates a new thread with its own scope and program stack. Using a set of options passed to the constructor, this environment may be restricted to a subset of what the primary interpreter can do and provide a safer environment for executing user supplied code.

If you dont want to use Runkit but still want a PHP Console on your server, try

  • Jordi Boggiano's Blog - PHP Console in Your Browser
  • http://github.com/seldaek/php-console

How do I tell if my application is running as a 32-bit or 64-bit application?

if (IntPtr.Size == 8) 
{
// 64 bit machine
}
else if (IntPtr.Size == 4)
{
// 32 bit machine
}

Real estate site, trying to only output properties based on type

Based on the PHP code in the fiddle (Which really shouldn't be there since the fiddle is for Javascript), it seems like the problem is that you never use the select_type given in the URL.

Take a look at this line. This is the first time $select_type is used.

if (!isset($select_type)) $select_type = "all";

Thus, $select_type will always be all.
Instead you should either change it to:

if (!isset($select_type)) $select_type = $_GET['select_type'];

Or just add this line before it:

$select_type = $_GET['select_type'];


Related Topics



Leave a reply



Submit