Form::get( string $key, mixed $default_value = null, array $arr = null )
Description #
Get a value from a path or default value if the path doesn’t exist
Parameters #
- $keystring (Required) Path.
- $default_valuemixed (Optional) Default value. Default value: null
- $arrarray (Optional) Array to search. Default value: null
Source #
File: lib/class-form.php
public function get( $key, $default_value = null, $arr = null ) { $keys = explode( '.', (string) $key ); if ( null === $arr ) { $arr = &$this->args; } foreach ( $keys as $key ) { if ( ! array_key_exists( $key, $arr ) ) { return $default_value; } $arr = &$arr[ $key ]; } return $arr; }
Expand full source code Collapse full source code View on GitHub: lib/class-form.php:365
Add your comment