|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2015-08-24 15:32 UTC] cmb@php.net
[2015-09-03 01:41 UTC] yohgaki@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
Description: ------------ The extract function skips setting variables that have names that are valid but cannot be written as a simple variable. For example, anything with dots can be written and accessed as a variable like: ${'some.config.setting'} = 'foo'; var_dump(${'some.config.setting'}); But extract considers anything with a dot in to be an invalid variable name, and so skips doing: extract(['some.config.setting'} => 'foo']); fails to extract it. Test script: --------------- $values = [ 'value.with.dot' => 'set from array', ]; extract($values); if (!isset(${'value.with.dot'})) { echo "It's not set\n"; } else { var_dump(${'value.with.dot'}); } ${'value.with.dot'} = "It is a valid variable name, just not one that can be written as a non-interpolated variable."; var_dump(${'value.with.dot'}); Expected result: ---------------- string(14) "set from array" Actual result: -------------- It's not set