A variable after a class name in PHP
Get the solution ↓↓↓Solution:
That syntax is incorrect. It should look like this:
class ClassNameOne {
public function __construct(AnotherClassName $one_variable){
//function task
}
}
The class name is given before the variable to specify the type of variable that will be passed to that function. So$one_variable
must be an instance of the classAnotherClassName
or it will throw an error.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: uncaught mysqli_sql_exception
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.