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

Assignment to array element reference does not count as a write #319

Open
sirbrillig opened this issue Mar 27, 2024 · 0 comments
Open

Assignment to array element reference does not count as a write #319

sirbrillig opened this issue Mar 27, 2024 · 0 comments

Comments

@sirbrillig
Copy link
Owner

static function dotToMultiArray(
	array $array
): array {
	$multi = [];
	foreach($array as $key => $value){
		$level = &$multi;
		foreach(explode(".", $key) as $node)
			$level = &$level[$node];
		$level = $value;
	}
	return $multi;
}

This marks $level as unused but the third assignment actually changes the referenced variable.

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