Simple php question

Soldato
Joined
18 Oct 2002
Posts
9,044
Location
London
Why does this work?

Code:
while ( $row = mysql_fetch_row($result) ) {
	echo("
		<tr>
			<td>$row[0]</td>
			<td>$row[1]</td>
			<td>".$row[2]."</td>
			<td>".$row[3]."</td>
			<td>".$row[4]."</td>
		</tr>");
}


I would have assumed that row0 and row1 would be printed out as text? But it all works perfectly...

If I were to do the same in classic asp this wouldn't work, it would assume it was all one long string rather than outputting row0 and row1.

Does that make sense? :)
 
Variables inside double-quoted strings are replaced by their value upon echoing to the screen.

If you'd used single quotes, then it would have printed the litteral $row[0] etc..
 
Back
Top Bottom