Way Out West Posted February 2, 2007 Share Posted February 2, 2007 Got one which I am sure is easy for everybody around these parts: I have been looking at some code and playing around with it: A line in the code goes along the lines of: echo "<td>" . $row['whatever'] . "</td>\n" Now I get everything except, what is the . bits between the table elements and also what does that \n mean? Like I say I am sure it is simple, but Googling comes up with very little when you don't know what you are searching for! Cheers. Link to comment https://forums.phpfreaks.com/topic/36766-solved-very-easy-simple-question/ Share on other sites More sharing options...
Balmung-San Posted February 2, 2007 Share Posted February 2, 2007 The . is the concatenator (spelling?). It connects two things together in a string. Example: <?php $a = "hello "; $b = "world"; $c = $a . $b; //Contains "hello world" ?> The \n is the newline character. It just says to move down a line. It's useful for keeping your source clean, and not only on one line. Link to comment https://forums.phpfreaks.com/topic/36766-solved-very-easy-simple-question/#findComment-175355 Share on other sites More sharing options...
obsidian Posted February 2, 2007 Share Posted February 2, 2007 The dot '.' is just a concatenation device in PHP (joins strings together). It's the same as joining strings with '+' in javascript. As for the '\n', that is a newline character. When used within double quotes, it causes the generated text to have a line break at the location of that character. *doh* Beat to it again Link to comment https://forums.phpfreaks.com/topic/36766-solved-very-easy-simple-question/#findComment-175356 Share on other sites More sharing options...
Way Out West Posted February 2, 2007 Author Share Posted February 2, 2007 Many thanks - thats one thats been bugging me - told you it was easy Link to comment https://forums.phpfreaks.com/topic/36766-solved-very-easy-simple-question/#findComment-175361 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.