CodeIgniter Forums
How to get model function name - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: How to get model function name (/showthread.php?tid=54157)



How to get model function name - El Forum - 08-25-2012

[eluser]l1v1[/eluser]
Hi guys, so I need to get the model function name. For example:

Code:
class some_model extends CI_Model{

public function validate_contacts() {
$function_name = 'validate_contacts'; // how to do this automatic by not typing it manually?
$this->create_system_message($function_name, 'required');
$this->create_system_message($function_name, 'blablabla');
  /* ... other code ... */
}

}



How to get model function name - El Forum - 08-25-2012

[eluser]Aken[/eluser]
__METHOD__

http://php.net/manual/en/language.constants.predefined.php


How to get model function name - El Forum - 08-25-2012

[eluser]l1v1[/eluser]
Thank you, didn't think it is so easy Smile