开发者

proper Use of Indirect Reference

开发者 https://www.devze.com 2022-12-22 15:34 出处:网络
I have this indirect Reference i wonder what\'s开发者_StackOverflow the usage of this $name = \"Air nike\";

I have this indirect Reference i wonder what's开发者_StackOverflow the usage of this

$name = "Air nike";
$$name = "Registered item";
print $AirNike;

I was thinking to put save all the items that are registered in a document by date and I was thinking of this technique and wanted to make sure it was ok. What would be a good place to implement a technique as the indirect Reference a


Your example code is nonsense, it tries to print a variable which is nothing like the one that I think you intended. If you wanted to print it, you would either need to print ${'Air nike'} or just reuse what you already have: $$name

As the comments to the question have mentioned, from your description this does not seem like something you should really be using in your script.

As for a good time to use these 'variable variables', arguably never. It is probably best to ignore them until such a time, if it ever comes, where you see a clear and pragmatic need (not use) for them.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号