What is wrong with this code please?


#1
What is wrong with this code please?

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
$the_array = array("bread", "endeavor", "sojourn", "integrity","divinity", "Providence");
$a=sort($the_array);
print join(",", $a);
?>


#2

try this

<?php
// Create an array with several elements in it,
// then sort it and print the joined elements to the screen
	$the_array = array("bread", "endeavor", "sojourn", "integrity","divinity", "Providence");
	sort($the_array);
	print_r($the_array); 
echo "<br/><br/>";
	echo join(', ', $the_array);
?>

#3

Thanks man. But that print_r function I don't understand it.


#4

ok I got this directly from php website. I thought it might help some people like me too about print_r()

print_r() displays information about a variable in a way that's readable by humans.

print_r(), var_dump() and var_export() will also show protected and private properties of objects with PHP 5. Static class members will not be shown.