Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Conversation

edsrzf
Copy link
Contributor

@edsrzf edsrzf commented Sep 11, 2022

PHP allows blocks to be added anywhere in a statement context. eg:

<?php {} { echo "We're inside a block\n"; }
@ryangjchandler
Copy link
Contributor

TIL! Just tried this out in Tinkerwell and I figured the reason I haven't ever seen this in PHP before is because it doesn't follow general lexical scoping rules like other languages.

@ryangjchandler ryangjchandler merged commit 47fd6a2 into php-rust-tools:main Sep 11, 2022
@edsrzf
Copy link
Contributor Author

edsrzf commented Sep 11, 2022

Yep, I'm not even sure what the use case is for blocks like this when there's no lexical scope. But it's part of the language. 🤷

@edsrzf edsrzf deleted the block-statement branch September 11, 2022 21:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants