3v4l.org

run code in 300+ PHP versions simultaneously
<?php class WP_Term { public $foo = 'foo'; public $data; // Change the visibility to protected or private and the script will throw an error. } $_POST['action'] = 'action'; function wp_parse_args( $args, $defaults = array() ) { if ( is_object( $args ) ) { $parsed_args = get_object_vars( $args ); } elseif ( is_array( $args ) ) { $parsed_args =& $args; } else { wp_parse_str( $args, $parsed_args ); } if ( is_array( $defaults ) && $defaults ) { return array_merge( $defaults, $parsed_args ); } return $parsed_args; } class WP_Ajax_Response { public $responses = array(); public function add( $args = '' ) { $defaults = array( 'what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, 'position' => 1, 'data' => '', 'supplemental' => array(), ); $parsed_args = wp_parse_args( $args, $defaults ); $position = preg_replace( '/[^a-z0-9:_-]/i', '', $parsed_args['position'] ); $id = $parsed_args['id']; $what = $parsed_args['what']; $action = $parsed_args['action']; $old_id = $parsed_args['old_id']; $data = $parsed_args['data']; $response = "<response_data><![CDATA[$data]]></response_data>"; $s = ''; if ( is_array( $parsed_args['supplemental'] ) ) { foreach ( $parsed_args['supplemental'] as $k => $v ) { $s .= "<$k><![CDATA[$v]]></$k>"; } $s = "<supplemental>$s</supplemental>"; } if ( false === $action ) { $action = $_POST['action']; } $x = ''; $x .= "<response action='{$action}_$id'>"; // The action attribute in the xml output is formatted like a nonce action. $x .= "<$what id='$id' " . ( false === $old_id ? '' : "old_id='$old_id' " ) . "position='$position'>"; $x .= $response; $x .= $s; $x .= "</$what>"; $x .= '</response>'; $this->responses[] = $x; return $x; } } $response = new WP_Ajax_Response(); $tag = new WP_Term(); $response->add( array( 'what' => 'term', 'supplemental' => (array) $tag, ) ); libxml_use_internal_errors( true ); $xml = simplexml_load_string( $response->responses[0], 'SimpleXMLElement' ); if ( $xml === false ) { echo 'Failed loading XML: '; foreach ( libxml_get_errors() as $error ) { // Display each error echo '<br>', $error->message . "\n"; } // Clear the error buffer to free memory libxml_clear_errors(); } else { // Your XML is correctly parsed, proceed with your logic echo 'XML loaded successfully.' . "\n"; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.20.0120.01220.70
8.4.10.0000.00920.03
8.3.150.0110.01117.51
8.3.140.0080.00018.82
8.3.130.0000.00917.06
8.3.120.0030.00719.41
8.3.110.0030.00620.94
8.3.100.0000.00924.06
8.3.90.0040.00426.77
8.3.80.0130.00017.13
8.3.70.0150.00618.81
8.3.60.0170.00725.92
8.3.50.0110.00625.92
8.3.40.0080.00825.92
8.2.270.0060.00317.67
8.2.260.0070.01116.73
8.2.250.0060.00318.81
8.2.240.0160.00317.41
8.2.230.0060.00322.58
8.2.220.0070.00337.54
8.2.210.0040.00426.77
8.2.200.0030.00719.04
8.2.190.0100.00716.72
8.2.180.0180.00725.92
8.2.170.0170.00325.92
8.1.310.0040.00416.95
8.1.300.0060.00320.35
8.1.290.0030.00718.88
8.1.280.0060.01325.92

preferences:
50.93 ms | 402 KiB | 5 Q