Cep Posted April 6, 2006 Share Posted April 6, 2006 I just had a thought but is it possible to declare a value for several variables at the same time?Maybe by doing this,$myVar, $myOther = 1; Link to comment https://forums.phpfreaks.com/topic/6729-simple-variable-question/ Share on other sites More sharing options...
trq Posted April 6, 2006 Share Posted April 6, 2006 Not in php. Ruby can do this...[code]a,b = 1,2[/code]Cool huh? But yeah... not php. Link to comment https://forums.phpfreaks.com/topic/6729-simple-variable-question/#findComment-24451 Share on other sites More sharing options...
obsidian Posted April 6, 2006 Share Posted April 6, 2006 [!--quoteo(post=362222:date=Apr 6 2006, 09:59 AM:name=thorpe)--][div class=\'quotetop\']QUOTE(thorpe @ Apr 6 2006, 09:59 AM) [snapback]362222[/snapback][/div][div class=\'quotemain\'][!--quotec--]Not in php.[/quote]actually, you can assign multiple variables the same value! it looks a little funny in practice, though:[code]// here's the principle$myVar = $myOther = 1;// you can link as many as you'd like. check this out:$one = $two = $three = $four = 1;echo "$one, $two, $three, $four";[/code]have fun with that! Link to comment https://forums.phpfreaks.com/topic/6729-simple-variable-question/#findComment-24456 Share on other sites More sharing options...
Cep Posted April 6, 2006 Author Share Posted April 6, 2006 hehe thanks guys! Link to comment https://forums.phpfreaks.com/topic/6729-simple-variable-question/#findComment-24458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.