oop - Why won't the shuffle function work in a PHP class? -


Why this will not alter the array, so I will get random results every time?

  class greeting {public $ greet = array ('hi', 'hello'); Shuffle ($ greetings); } $ Hi = New greetings; Echo $ hi- & gt; Hello [1];   

Is there anything wrong with my code?

If you change this, so that the shuffle within the conferencer is fine.

  class greeting {public $ greet = array ('hi', 'hello'); Function __ construct () {alter ($ this-> greeting); }}    

Comments