-
-
Save cyberwani/4396417 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MyPlugin { | |
static function activation_hook() { | |
if ( ! version_compare( PHP_VERSION, '5.3.0', '>=' ) ) { | |
deactivate_plugins( __FILE__ ); | |
wp_die( wp_sprintf( '%1s: ' . __( 'Sorry, This plugin has taken a bold step in requiring PHP 5.3.0+. Your server is currently running PHP %2s, Please bug your host to upgrade to a recent version of PHP which is less bug-prone.', 'myplugin' ), __FILE__ , PHP_VERSION ) ); | |
} | |
} | |
} | |
register_activation_hook( __FILE__, array( 'MyPlugin', 'activation_hook' ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo preg_replace_callback( '/^(Hello)\s(\w+)\s(World)$/', function ( $match ) { | |
return $match[ 1 ] . ', awesome ' . $match[ 3 ] . '!'; | |
}, 'Hello cruel World' ); // => "Hello, awesome World!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
uasort( $array, function( $a, $b ) { | |
return $a > $b; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment