Skip to content

Conversation

@dd32
Copy link
Owner

@dd32 dd32 commented Apr 1, 2022

WIP idea.

http://example.org/?foo[]=bar&baz[bar]=3

// Sub-key access
$value = WP::get( [ 'baz', 'bar' ], 1, 'integer'  );
var_dump( $value ); // int 3

// Sub key => Default
$value = WP::get( [ 'foo', 'unset', 'value' ], 1, 'integer'  );
var_dump( $value ); // int 1

// Something that's actually kind meh.. "foo[]=bar" => float 1 ??
$value = WP::get( 'foo', false, 'number'  );
var_dump( $value ); // float 1 - not an array.

// Something that's better than worst case, "foo[]=.." => string val "Array"
$value = WP::get( 'foo', 'default value here', 'string'  );
var_dump( $value ); // string 'Array'

@dd32 dd32 closed this Nov 7, 2025
@dd32 dd32 reopened this Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants