Liquid Fire Posted April 6, 2007 Share Posted April 6, 2007 I have been converting alot of perl to php at work and was wondering soemthing, is there a way to set the value of multiple variables at one time. Here is example of perl code: my($TotPax,$TotPax2,$F_RoomPrice,$F_Sup,$F_INSAmt,$F_S,$F_Total,$F_P,$F_TotalCommission,$F_Owed,$F_Custs)=0; can i do something like: $var1, $var2, $var3, etc... = 0; i think that gives an error but is ther another way? Link to comment https://forums.phpfreaks.com/topic/45890-set-the-value-of-more-than-one-variable-at-a-time/ Share on other sites More sharing options...
Jove Posted April 6, 2007 Share Posted April 6, 2007 do something like this: $var1=$var2=$var3=...=0; Link to comment https://forums.phpfreaks.com/topic/45890-set-the-value-of-more-than-one-variable-at-a-time/#findComment-222922 Share on other sites More sharing options...
roopurt18 Posted April 6, 2007 Share Posted April 6, 2007 $var1 = $var2 = $var3 = 0; Link to comment https://forums.phpfreaks.com/topic/45890-set-the-value-of-more-than-one-variable-at-a-time/#findComment-222923 Share on other sites More sharing options...
Liquid Fire Posted April 6, 2007 Author Share Posted April 6, 2007 cool. Link to comment https://forums.phpfreaks.com/topic/45890-set-the-value-of-more-than-one-variable-at-a-time/#findComment-222925 Share on other sites More sharing options...
effigy Posted April 6, 2007 Share Posted April 6, 2007 Just a note: The Perl is not correct; it will only set $TotPax to 0 and leave the rest undefined (undef). Link to comment https://forums.phpfreaks.com/topic/45890-set-the-value-of-more-than-one-variable-at-a-time/#findComment-222926 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.