php - How to use list and array to instantiate fields in a class? -
Get link
Facebook
X
Pinterest
Email
Other Apps
I want to instanciate each area of my PHP class at the same time. So far, I tried to use the list here my code is down (which does not work). Any help will be accepted happily. class test {personal $ x; Private $ y; Private $ z; Public Function Test () {$ fields = array ($ this-> x = $ this-> y, $ this- & gt; z); // I need a $ field here to be an array I list ($ field) = array (1, 2, 3); // $ field was not an array, if it would work echo 'x =' $ this-> X '& lt; Br / & gt; Y = '$ this- & gt; Y '& lt; Br / & gt; Z = '$ this- & gt; Z; }} New test ();
list ($ this-> x, $ this- & Gt; Y, $ this- & gt; z) = array (1, 2, 3);
Comments
Post a Comment