0
I did this code in php but there is a error so solve it if u can help me.
4 Answers
+ 1
Adi Pund
There is problem in concating string and also I have changed your code as per rules of programming.
Try to print each value in separate lines for better readability of code.
https://code.sololearn.com/wycjqkCfG9BZ/?ref=app
0
Adi Pund
[ main part ]
despite your code isn't indented, wich would improve readability, there's only one line (114) where there are two mistakes: one is obvious, the other is more hidden ^^
the obvious one is you messed up first string quotation by enclosing "employee id" in double quotes, followed by a colon, a space and one single quote wich makes starting a new string where you should expect ending the first...
correct fix is to either write: "employee id: " or 'employee id: '...
however, that's not the error showed by your code initialy, at it encounter before another less obvious mistake: right after the 'echo' keyword, you've put two spaces: the first one is a non-breaking space (char code 160), wich is invalid in coding outside of string literals... the second one is a 'normal' space (char code 32). ^^
correcting this 2 points (delete 1st space after 'echo' & correctly enclosing 1st string, by having the colon inside it) is enough to let your code run without errors ;)
[ to be continued... ]
0
[ addendum part ]
even without errors, your code have some flawless, from wich the indentation is the less important (but could help you to better think your code)...
at 'displayinfo' function call, you pass arguments wich doesn't match the function signature (expected arguments): the function expect one $user argument, while you give employee properties values...
inside the function you use the $user variable to construct a new 'manager' instance, on wich you hardcode (again) the properties values assigned ^^
also, as long as class properties are declared 'public', you doesn't really need setters and getters, because you could access them directly from outside... and initializing them could be done through a '__construct' method in the class ;)
https://code.sololearn.com/wrJXpxh4DH4V/?ref=app
0
Thanks đ