linux1880 Posted January 30, 2010 Share Posted January 30, 2010 Hi friends i am trying to add some feature in one script, I see everywhere in the script like $data_set["something"] and $another_set["another_thing"] like that, how do i actually know where in the script has this array defined ? Or is that array referring to a table with all the fields ? Or can people define such array on the fly and assume variables as they want ? Please help. Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/190389-how-do-you-know-the-defination-of-array-and-thier-list-in-such-variable/ Share on other sites More sharing options...
ToonMariner Posted January 30, 2010 Share Posted January 30, 2010 search your code for it - it could be set in code that is included - so search you entire project for that array and see what it throws out. Quote Link to comment https://forums.phpfreaks.com/topic/190389-how-do-you-know-the-defination-of-array-and-thier-list-in-such-variable/#findComment-1004353 Share on other sites More sharing options...
linux1880 Posted January 30, 2010 Author Share Posted January 30, 2010 well, searched but could not find any place where he has defined those array variables. They have also used lots session variables like $_SESSION['yeah_right'], $SESSION['oh_no'] ... and blah are they need to be defoened as well or we can assigm anything on the fly ? Sorry for the stupid questions as i am new to php and this community. Thanks Quote Link to comment https://forums.phpfreaks.com/topic/190389-how-do-you-know-the-defination-of-array-and-thier-list-in-such-variable/#findComment-1004366 Share on other sites More sharing options...
Alex Posted January 30, 2010 Share Posted January 30, 2010 It's possible the array was never explicitly defined. Doing something like this: <?php $foo['bar'] = 'foobar'; Is completely valid. Though, it's usually a good idea to define your arrays somewhere as not to create confusion if someone else is looking over your code. Quote Link to comment https://forums.phpfreaks.com/topic/190389-how-do-you-know-the-defination-of-array-and-thier-list-in-such-variable/#findComment-1004369 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.