Welcome Guest, Not a member yet? Register   Sign In
Proper way to get array from session
#1

I have a session which contains an item called "error", this item contains an array with the following structure:

array(1) { ["meta.featured_image"]=> string(60) "Il file meta.featured_image supera le dimensioni consentite." }

I'm trying to print the item featured_image, so I did
this:

PHP Code:
<?= session('error.meta.featured_image'?>


But the code above returns NULL

but if I do 

PHP Code:
<?= session('error')['meta']['featured_image'?>

works but I need to check if the index exists to prevent error, there is no way to get the featured_image index directly in the session?
Reply


Messages In This Thread
Proper way to get array from session - by sfarzoso - 04-17-2021, 10:57 AM



Theme © iAndrew 2016 - Forum software by © MyBB