Welcome Guest, Not a member yet? Register   Sign In
How to update value by Events in CodeIgniter 4
#2

This is not tested but I think you need to pass the array by reference.

PHP Code:
Events::on('add_value_to_array', function(&$array) {
    error_log("add_value_to_array" PHP_EOL3"events.txt");
    $array[] = 'new';
}); 

You can try your way with array_pust but then you making an extra function call.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
RE: How to update value by Events in CodeIgniter 4 - by InsiteFX - 04-05-2021, 10:40 AM



Theme © iAndrew 2016 - Forum software by © MyBB