frijole Posted February 11, 2008 Share Posted February 11, 2008 I found this in some code I am looking through and I do not know if this serves some function or if it is a typo? $$field = $value; ?? Link to comment https://forums.phpfreaks.com/topic/90450-field-value-are-the-two-a-typo/ Share on other sites More sharing options...
vbnullchar Posted February 11, 2008 Share Posted February 11, 2008 no thats not a typo.. it is called a variable variables Link to comment https://forums.phpfreaks.com/topic/90450-field-value-are-the-two-a-typo/#findComment-463708 Share on other sites More sharing options...
frijole Posted February 11, 2008 Author Share Posted February 11, 2008 can anyone explain the purpose of that? Link to comment https://forums.phpfreaks.com/topic/90450-field-value-are-the-two-a-typo/#findComment-463724 Share on other sites More sharing options...
nethnet Posted February 11, 2008 Share Posted February 11, 2008 That syntax is used for dynamic variable nomenclature... in other words, if $field is equal to "hello", then a new varialbe called $hello would be created and set to the value of $value. Theo Link to comment https://forums.phpfreaks.com/topic/90450-field-value-are-the-two-a-typo/#findComment-463732 Share on other sites More sharing options...
PFMaBiSmAd Posted February 11, 2008 Share Posted February 11, 2008 Variable variables should only be used when necessary. Most of the time using an array is more appropriate and results in less code. Code using variable variables is also 2-3 times slower than using an array. Link to comment https://forums.phpfreaks.com/topic/90450-field-value-are-the-two-a-typo/#findComment-463736 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.