3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PO { public $entries = array( "1\n", "a\n\n" ); public static function export_entry( &$entry ) { return trim($entry); } function export_entriesA() { return implode( "\n\n", array_map( array( 'PO', 'export_entry' ), $this->entries ) ); } function export_entriesB() { array_walk( $this->entries, array( 'PO', 'export_entry' ) ); return implode( "\n\n", $this->entries ); } function export_entriesC() { $entries = $this->entries; array_walk( $this->entries, array( 'PO', 'export_entry' ) ); return implode( "\n\n", $entries ); } } $obj = new PO(); var_dump($obj->export_entriesA()); var_dump($obj->entries); var_dump($obj->export_entriesC()); var_dump($obj->entries); var_dump($obj->export_entriesB()); var_dump($obj->entries);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: PO::export_entry(): Argument #1 ($entry) must be passed by reference, value given in /in/KbpLJ on line 11 Warning: PO::export_entry(): Argument #1 ($entry) must be passed by reference, value given in /in/KbpLJ on line 11 string(4) "1 a" array(2) { [0]=> string(2) "1 " [1]=> string(3) "a " } string(7) "1 a " array(2) { [0]=> string(2) "1 " [1]=> string(3) "a " } string(7) "1 a " array(2) { [0]=> string(2) "1 " [1]=> string(3) "a " }

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:
81.8 ms | 402 KiB | 8 Q