Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data_get的key麻烦强制转换下为字符串,比如__toString()这样的特性就可以用到了 #1

Open
aogg opened this issue Sep 20, 2024 · 0 comments

Comments

@aogg
Copy link
Contributor

aogg commented Sep 20, 2024

/**
 * Get an item from an array or object using "dot" notation.
 *
 * @param mixed $target
 * @param null|array|int|string $key
 * @param mixed $default
 * @return mixed
 */
function data_get($target, $key, $default = null)
{
    if (is_null($key)) {
        return $target;
    }

    $key = is_array($key) ? $key : explode('.', strval($key));

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

No branches or pull requests

1 participant