3v4l.org

run code in 300+ PHP versions simultaneously
<?php define( 'TESTDOX', true ); function wp_is_development_mode( $mode = null ) { $current_mode = wp_get_development_mode(); if ( empty( $current_mode ) ) { return '' === $mode; } // Return true if the current mode encompasses all modes. if ( 'all' === $current_mode ) { return true; } // Return true if the current mode is the given mode. return $mode === $current_mode; } // Polyfill. global $test_development_mode; function wp_get_development_mode() { global $test_development_mode; return $test_development_mode; } // Test cases. $dataset = array( 'both are empty strings' => array( 'mode' => '', 'dev' => '', 'expected' => true, ), 'both are non-empty, matching strings' => array( 'mode' => 'plugin', 'dev' => 'plugin', 'expected' => true, ), 'both are non-empty, unmatching strings' => array( 'mode' => 'core', 'dev' => 'theme', 'expected' => false, ), '$mode is null and development mode is an empty string' => array( 'mode' => null, 'dev' => '', 'expected' => false, ), '$mode is an empty string, development mode is a non-empty string' => array( 'mode' => '', 'dev' => 'core', 'expected' => false, ), '$mode is a non-empty string, development mode is an empty string' => array( 'mode' => 'core', 'dev' => '', 'expected' => false, ), ); foreach ( $dataset as $name => $data ) { $test_development_mode = $data['dev']; $actual = null === $data['mode'] ? wp_is_development_mode() : wp_is_development_mode( $data['mode'] ); $result = $actual === $data['expected'] ? '.' : 'F'; if ( defined( 'TESTDOX' ) && TESTDOX ) { echo '.' === $result ? 'PASS' : 'FAIL', ': ', $name, ' (', var_export( $data['expected'], true ), ')', PHP_EOL; } else { echo $result; } }
Output for git.master_jit, git.master, rfc.property-hooks
PASS: both are empty strings (true) PASS: both are non-empty, matching strings (true) PASS: both are non-empty, unmatching strings (false) PASS: $mode is null and development mode is an empty string (false) PASS: $mode is an empty string, development mode is a non-empty string (false) PASS: $mode is a non-empty string, development mode is an empty string (false)

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:
26.44 ms | 406 KiB | 5 Q