I have written down the following for the above question
<?php
class sortClass{
public function __construct(array $arrayPassed){
return sort($arrayPassed);
}
}
$newarray=array(11,-2,4,35,0,8,-9);
$sorted = new sortClass($newarray);
print_r($sorted);
?>
And the output is 'sortClass Object()' , I'd like some help to understand why it would not print out the sorted array , When we instantiate a class - the constructor will automatically execute and return what ever it returns right? so why isn;t printing $sorted object printing whats returned in the constructor?
new ...is a new object of the class type.