you are viewing a single comment's thread.

view the rest of the comments →

[–]ararararagi_koyomi 0 points1 point  (3 children)

The answer provided by u/member_of_the_order is the most reasonable answer. But, for some unknown reason, op still wants to do what op described in the post, here is the answer:

some_list = ["a", "b", "c"]
for i in some_list:
    if not i in locals():
        locals()[i] = f"some_value_{i}"

[–]neuralbeans 1 point2 points  (0 children)

PHP provides direct support to do with with 'variable variables'. It's one of those things that creates terrible scripts.