Hi..
I'm really new in php..
and cant understand a part from this code below and hope somebody could explain to me :

while ($subject = mysql_fetch_array($subject_set)) {
			echo "<li>{$subject["menu_name"]}</li>";
			$page_set = mysql_query("SELECT * FROM pages WHERE subject_id = {$subject["id"]}", $connection);
			if (!$page_set) {
				die("Database query failed: " . mysql_error());
			}

			echo "<ul class=\"pages\">";
			while ($page = mysql_fetch_array($page_set)) {
				echo "<li>{$page["menu_name"]}</li>";
			}
			echo "</ul>";
		}

The thing that i need explanation is that what is the meaning of curly braces "{" there
in {$subject["menu_name"]} and {$subject["id"]} ?

could you tell me the difference of the usage between those two?
because,i realize that it is just fine if i remove the curly braces on {$subject["menu_name"]} and doing something else but not on {$subject["id"]} .

Help me please..
Thank You :)

The braces casue to PHP to parse the array and return the value found in that cell.
Try removing them. You will get an error.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.