3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class MyFile { private $filename; private $mimeType; public function __construct($filename, $mimeType) { $this->filename = $filename; $this->mimeType = $mimeType; } public function getFilename() { return $this->filename; } public function getMimeType() { return $this->mimeType; } } $file1 = new MyFile("peter.jpg", "image/jpg"); $file2 = new MyFile("michal.jpg", "image/jpg"); $file3 = new MyFile("johan.jpg", "image/jpg"); $file4 = new MyFile("peter.jpg", "image/jpg"); $array1[] = $file1; $array1[] = $file2; $array2[] = $file3; $array2[] = $file4; $diffArray = array_diff($array1, $array2); var_dump($diffArray);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Object of class MyFile could not be converted to string in /in/d7P5h:34 Stack trace: #0 /in/d7P5h(34): array_diff(Array, Array) #1 {main} thrown in /in/d7P5h on line 34
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.4 ms | 401 KiB | 8 Q