php - Why are my variables passed by reference? -
I have created a function that first creates two datasets based on data:
// Initial Date Time (for testing) $ dt = new \ Datetime; $ Dt-> Set date (2012, 9, 5); // puts the split in 2 separate statistics $ dates = $ this-> Defined bitrate ($ dt); // $ Date [0] = 2011-07-01 // $ Dates [1] = 2012-09-01 For the moment, everything is right now I have no idea about these datasets Function in which I use the while loop which increases the earlier date until it reaches the second number: < Code> // Now I use 2 data in a function ... $ dateKeys = $ this- & gt; Generated data ($ date [0], $ date [1]); // and the function seems to modify them out of themselves! // $ Dates [0] = 2012-10-01 // $ Dates [1] = 2012-09-01 It seems that when there is a loop inside my work GenerateDateKeys does not modify the parameter locally This function changes the value of $ date outside. But I am never using context. Can anyone realize me about this?
PHP passes all the objects by reference by default.
More info here:
Comments
Post a Comment