dinita Posted October 10, 2012 Share Posted October 10, 2012 quick question really.. trying to call an extract function where the keys of the array are numbers? a variable cannot start with a number, so how would I call my new variables? Quote Link to comment https://forums.phpfreaks.com/topic/269311-extract-function/ Share on other sites More sharing options...
salathe Posted October 10, 2012 Share Posted October 10, 2012 Use a prefix, see the extract() docs. However, do you really need to extract those values into variables, more often than not it makes more sense to keep working with the array. Quote Link to comment https://forums.phpfreaks.com/topic/269311-extract-function/#findComment-1384226 Share on other sites More sharing options...
ManiacDan Posted October 10, 2012 Share Posted October 10, 2012 Don't use extract at all, just use the array. If you use extract, you're creating mystery variables and duplicating content. Quote Link to comment https://forums.phpfreaks.com/topic/269311-extract-function/#findComment-1384241 Share on other sites More sharing options...
nodirtyrockstar Posted October 10, 2012 Share Posted October 10, 2012 Start them with an underscore? You can add/remove it dynamically. Or use a letter, or some other allowed character. Quote Link to comment https://forums.phpfreaks.com/topic/269311-extract-function/#findComment-1384277 Share on other sites More sharing options...
Christian F. Posted October 10, 2012 Share Posted October 10, 2012 ManiacDan's post is the one that you should go for, without doubt. If your code absolutely requires the use of extract (), then you're most likely doing it wrong. Quote Link to comment https://forums.phpfreaks.com/topic/269311-extract-function/#findComment-1384322 Share on other sites More sharing options...
salathe Posted October 10, 2012 Share Posted October 10, 2012 you're most likely doing it wrong. No need to repeat what other people have already said. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/269311-extract-function/#findComment-1384331 Share on other sites More sharing options...
dinita Posted October 11, 2012 Author Share Posted October 11, 2012 your right I was doing it wrong! I thought I needed the array to split into separate variables so the Actionscript could read these and display them into separate boxes by calling each variable. Instead I've used the array to echo a string split using backslashes and removed the backslashes in the Actionscript using the split function and then turned that string into an array. Thanks for being so patient with me! Quote Link to comment https://forums.phpfreaks.com/topic/269311-extract-function/#findComment-1384544 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.