CodeIgniter Forums
Where to put odds & ends PHP functions? - 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: Where to put odds & ends PHP functions? (/showthread.php?tid=14011)



Where to put odds & ends PHP functions? - El Forum - 12-15-2008

[eluser]Unknown[/eluser]
I'm using a pre-PHP 5.2 version of PHP and need json_encode. I have a replacement function in a PHP file, but need to know where this type of thing is meant to go to hook into my app.

I realize I could put it anywhere and include the file, but is there a specific location for these things to go?

Thanks in advance!


Where to put odds & ends PHP functions? - El Forum - 12-15-2008

[eluser]Phil Sturgeon[/eluser]
You can chuck that in a helper file, wrapped in a if(function_exists()) like the standard ones do.

Take a look at Helpers in the User Guide.


Where to put odds & ends PHP functions? - El Forum - 12-15-2008

[eluser]Unknown[/eluser]
Actually, I realized it falls more in the category of a plugin. Thanks for the reply!