PHP tester allows to test PHP code Online without install.
You can test your code easily and quickly. You can test PHP 8 :)
You can test PHP MySQL with PDO,
and also test PHP Sodium (PHP 7.4.8 and PHP 8 Only).
To execute your code, you must copy and paste, drag and drop a PHP file or directly type
in the "PHP code" online editor below, and click on "Run" button.
First, Drag and drop your PHP file or copy / paste your PHP text directly into the editor above.
Finally, you must click on "Run" button to display the result.
How to share PHP code:
Click on the menu button "Save & share".
Choice a password to protect your share, so only you can change it.
Note the URL to access your share.
How to test PHP MySQL Online using PDO:
Click on the menu button "Load example" > "PDO / MySQL".
How to generate public and secret keys Online using sodium:
Click on the menu button "Load example" > "Sodium / Generate public and secret keys".
PHP tester
PHP code tester is a web-based tool, it allows to test PHP code online directly in your browser.
You can write, test, and run PHP code.
Your code is executed on our server, it is only stored for the time to execute it.
This PHP playground can be useful to make online test to save time (deployment ...).
You can also share your code, this can be useful for example when you have a problem and want to share it on a forum.
You can test different version of PHP (5.6.40, 7.4.8 and 8).
Doing PHP online allows you not to have lots of versions of PHP on your computer.
You can use the PDO module (MySQL database).
If you need to test a particular module or another database, you can specify it in a comment (I will study the request).
With an online PHP editor, developers can quickly write and test code without needing to install and set up a local development environment.
Note: Some functions have been disabled for security reasons.
$dsn = "mysql:host=mysql;dbname=php_tester";
$user = "php_tester";
$passwd = "password";
$pdo = new PDO($dsn, $user, $passwd);
$stm = $pdo->query("SELECT '1' as id, 'Albert' as name UNION SELECT '2' as id, 'Isaac' as name UNION SELECT '3' as id, 'Marie' as name ");
$rows = $stm->fetchAll(PDO::FETCH_NUM);
foreach($rows as $row) {
echo(json_encode($row)."\n");
}
// Connect to phpTester database
$manager = new MongoDB\Driver\Manager("mongodb://php-tester:123@localhost:27017/phpTester");
// Insert a document
$bulkWrite=new MongoDB\Driver\BulkWrite;
$doc=array("title" => "PHP Tester", "description" => "Test PHP code online");
$bulkWrite->insert($doc);
$manager->executeBulkWrite('phpTester.example', $bulkWrite);
// Get all documents
$query = new MongoDB\Driver\Query(array());
$cursor = $manager->executeQuery('phpTester.example', $query);
// Convert to Array and print result
print_r($cursor->toArray());
// Delete all documents
$bulkDelete = new MongoDB\Driver\BulkWrite;
$bulkDelete->delete(['title' => 'PHP Tester' ], ['limit' => 0]);
$manager->executeBulkWrite('phpTester.example', $bulkDelete);