calling a function in a library - 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: calling a function in a library (/showthread.php?tid=27501) |
calling a function in a library - El Forum - 02-12-2010 [eluser]stef25[/eluser] How do I call a function in a library from another function in that same library? I have my $CI =& get_instance(); and the function I want to call is say test(). Ive tried calling it via test(), $this->test(), $CI->test(), $CI->lib_name->test() ... ? calling a function in a library - El Forum - 02-12-2010 [eluser]danmontgomery[/eluser] Code: $this->test(); calling a function in a library - El Forum - 02-12-2010 [eluser]stef25[/eluser] That gives a Call to undefined function error. calling a function in a library - El Forum - 02-12-2010 [eluser]danmontgomery[/eluser] Then you're doing something else wrong, post some code. calling a function in a library - El Forum - 02-12-2010 [eluser]stef25[/eluser] Code: class my_lib { calling a function in a library - El Forum - 02-12-2010 [eluser]danmontgomery[/eluser] Code: $count += count_key($val, $key); Code: $count += $this->count_key($val, $key); calling a function in a library - El Forum - 02-12-2010 [eluser]stef25[/eluser] Great catch, thanks. I was looking at the wrong line number. calling a function in a library - El Forum - 02-12-2010 [eluser]danmontgomery[/eluser] Cheers |