astralaaron Posted May 17, 2007 Share Posted May 17, 2007 $sql2="SELECT * FROM $tbl_name2 WHERE question_id='$id' LIMIT {$start}, {$per_page}";it works fine theres no problem with it, i just want to understand why { } are around the $start and $per_page?why are { } needed? what do they do? Link to comment Share on other sites More sharing options...
Anders Moen Posted May 17, 2007 Share Posted May 17, 2007 I don't think you need them. I never use { and } except in else { } and if { } and all that... Link to comment Share on other sites More sharing options...
reportingsjr Posted May 17, 2007 Share Posted May 17, 2007 Its just so its easier to see, or if you do something like this: $string = "$myvared and something else"; If for some reason you wanted to add "ed" to the var. It will think the variable name is $myvared when it should actually be $myvar. So you can do this: $string = "{$myvar}ed and something else"; :)Mainly its used for readability. Link to comment Share on other sites More sharing options...
justsomeguy Posted May 17, 2007 Share Posted May 17, 2007 It's also the correct way to reference an array in a string:echo "the name is {$user['name']}"; Link to comment Share on other sites More sharing options...
astralaaron Posted May 17, 2007 Author Share Posted May 17, 2007 cool, thank you everyone. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.