Skip to content

Instantly share code, notes, and snippets.

@westonruter
Last active December 11, 2016 20:01
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save westonruter/35105d1e3d29a9964d9063894add3b40 to your computer and use it in GitHub Desktop.
<?php
function __return_value( $value ) {
return create_function( '', sprintf( 'return %s;', var_export( $value, true ) ) );
}
<?php
function __return_value( $value ) {
return function () use ( $value ) {
return $value;
};
}
<?php
add_filter( 'section_count', __return_value( 5 ) );
add_filter( 'allowed_properties', __return_value( array( 'foo', 'bar', 'baz' ) ) );
add_filter( 'cup_overfloweth_amount', __return_value( 1.5 ) );
@fjarrett
Copy link

This.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment