Sending variables between 2 functions - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Sending variables between 2 functions (/showthread.php?tid=7309) |
Sending variables between 2 functions - El Forum - 04-03-2008 [eluser]luukskywalker[/eluser] i have a small question i have 2 functions -> Function_A() and Function B() and i want to send a variable from function a to function b. I want something like this(this is just an example): Code: Function_a(){ is this possible? Sending variables between 2 functions - El Forum - 04-03-2008 [eluser]xwero[/eluser] That is some bad example code If you have methods (functions) in a class you can do Code: class Someclass if it are separate functions you can only pass values by using parameters. You could use a global but that is bad practice. Sending variables between 2 functions - El Forum - 04-03-2008 [eluser]luukskywalker[/eluser] Nice this works fine. Thank you. P.s. sorry for the bad example code. I changed it like a thousand times to make clear what i meant I kinda became sucky Sending variables between 2 functions - El Forum - 04-03-2008 [eluser]webthink[/eluser] Since you asked about sending a variable between functions you should probably see this example as well (not everything should be set as a class attribute) Code: class Someclass |