7. Array Function II why its giving error


#1
<html>
    <p>
	<?php
	// Create an array with several elements in it,
	// then sort it and print the joined elements to the screen
    $the_array = array(5, 7, 99);
    sort($the_array);
    print join("," $the_array);
	?>
	</p>
	<p>
	<?php
	// Reverse sort your array and print the joined elements to the screen
	$the_array = array(5,7,99,56,89,45,44);
    rsort($the_array);
    print join(":" $the_array);
	?>
	</p>
</html>

Its Throwing an error.. always. please dig up my mistakes ..


#2

Here: print join("," $the_array); and here: print join(":" $the_array);you missed commas after first argument.
join function takes two arguments and arguments should be separated by comma.

Corrected syntax:

print join(",", $the_array); and print join(":", $the_array);


#4

Ohh Its done.. Thanks mate.. My Mistake .. :chocolate_bar: ..


#5



<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$the_array = array(5, 3, 7, 1);
sort($the_array);
print join(", ", $the_array);
?>
?>



<?php
// Reverse sort your array and print the joined elements to the screen

$the_array = array(5, 3, 7 ,1);
rsort($the_array);
print join(", ", $the_array);
?>