This question already has an answer here:
- PHP constants with local scope 1 answer
Is it possible to have constants in PHP that are function-scoped?
If not, what's the preferred alternative for the case where we need a constant inside a function (not a method)?
EDIT
My particular use case:
I have a function that works with a db. I'd like to store the table name (and potentially, other information that won't change, such as the field names) in a constant (vs just "hardcoding" it in the connection string). Other functions don't need to know about my table name.
</div>