csplrj Posted July 13, 2007 Share Posted July 13, 2007 Parse error: syntax error, unexpected '&', expecting T_VARIABLE or '$' in /a/page1.php on line 121 I am getting the above error I have used & operator to pass the value by refrence. This works in PHP 5 but not in 4.4.2. Is that & operator is not availabe in PHP 4.4.2? Thanks in advance CSJakharia Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted July 13, 2007 Share Posted July 13, 2007 Could you post the part of the code giving you the error? Quote Link to comment Share on other sites More sharing options...
teng84 Posted July 13, 2007 Share Posted July 13, 2007 ya post the part of that code but maybe u use & instead of $ for the declaration of variable Quote Link to comment Share on other sites More sharing options...
csplrj Posted July 13, 2007 Author Share Posted July 13, 2007 The code is foreach($row as &$value) This works on PHP 5 but not on PHP 4.4.2 Bye for now CSJakharia Quote Link to comment Share on other sites More sharing options...
infid3l Posted July 13, 2007 Share Posted July 13, 2007 The code is foreach($row as &$value) This works on PHP 5 but not on PHP 4.4.2 Bye for now CSJakharia It's not available in 4.4.2. As of PHP 5, you can easily modify array's elements by preceding $value with &. This will assign reference instead of copying the value. Quote Link to comment Share on other sites More sharing options...
csplrj Posted July 13, 2007 Author Share Posted July 13, 2007 Is there any turnaround to this Actually I am changing the value of the elements of the array. Is there any other way to achieve this? Thanks in advance CSJakharia Quote Link to comment Share on other sites More sharing options...
csplrj Posted July 13, 2007 Author Share Posted July 13, 2007 Thanks I got turnaround we can use foreach($row as $key=>$value) instead of that & operator Bye for now CSJakharia Quote Link to comment 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.