PHP Online IDE & Code Editor for Technical Interviews

Running Zend PHP 8.0 - IntelliSense is not available

You must wrap your code in <?php and ?> tags. Text outside of those tags will output to stdout without processing as PHP.

PHP’s mcrypt library is also installed.

PHPUnit can be used to write tests. To use it, just run your tests inline after adding the line use PHPUnit\Framework\TestCase; like so:

<?php class Greeter { public function sayHello($name) { return "hi, " . $name; } } use PHPUnit\Framework\TestCase; class Solution extends TestCase { private $greeter; protected function setUp(): void { parent::setUp(); $this->greeter = new Greeter(); } protected function tearDown(): void { parent::tearDown(); $this->greeter = NULL; } public function testSayHello() { $result = $this->greeter->sayHello("friend"); $this->assertEquals("hi, friend", $result); } }
Code language: PHP (php)

Try Our PHP Editor