3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php // Begin polyfills. function get_option(){} function add_option(){} function update_option(){} // Begin Kristine's code sample. $options = get_option ('foo_cache_plugin'); if ( !$options) { //add option if option doesn't exist yet add_option (foo_cache_plugin, array ( 'foo_should_cache' => 'true', 'foo_should_display_notice' => 'false', 'foo_should_cache_logged_in_users' => 'false' )); } else { //update option if it exists $options [foo_should_cache] = 'true'; $options [foo_should_display_notice] = 'false'; $options [foo_should_cache_logged_in_users] = 'false'; update_option ('foo_cache_plugin', $options); }
based on 1W5Jj
Output for 7.2.0
Warning: Use of undefined constant foo_cache_plugin - assumed 'foo_cache_plugin' (this will throw an Error in a future version of PHP) in /in/dvbZ1 on line 12
Output for 5.3.18 - 7.1.10
Notice: Use of undefined constant foo_cache_plugin - assumed 'foo_cache_plugin' in /in/dvbZ1 on line 12