Varying naming conventions/pre-defined method names...<smile>

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Something spent a bit of time trying to sort out yesterday, until I realised that it doesn't always help to have recently worked in a few different programming languages, etc...<smile>

Effectively, was trying to figure out why wasn't managing to pass varying numbers of parameters to the class constructor function in PHP - and eventually figured out that it doesn't help to have sort of automatically used the __init__ method name for the constructor function/method, since that's the one you'd use in python, but in PHP, you use __construct.

Think that aside from having sort of automatically just typed it in without thinking too much about it, the fact that they both start with the double underline character meant that thereafter, I was most likely ignoring/not paying much attention to that specific piece/part of the code, while was trying to figure out why it then wouldn't allow me to determine how many parameters had been passed, which of them in the collection were then actually named/being defined, etc. etc.

Meant that while I had some sort of class properties being pre-defined/pre-set, it wasn't handling the re-assignment of values I thought I was passing in, and then I moved over to thinking that was somehow handling the assignment evaluation/determination incorrectly, etc., and even ended up trying to assign certain property values sort of by default to make sure that the function call/constructor was being made use of - that's roundabout when realised what had done wrong...

Funny to think about it now, but at the time, it was becoming a little frustrating...LOL!

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux