How can i get model name from model instance.
For e.x.
$model=new State;
here,
State is model
$model is State model instance.
I want to get model name i.e State from $model i.e model instance.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
get_class() — Returns the name of the class of an object
string get_class ([ object $object ] )
therefore you use it like this: $modelname=get_class($modelinstance);
->it returns a string.