Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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

This comment has been minimized.

Copy link

@fjarrett fjarrett commented Dec 11, 2016

This.

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