|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
maximang Smarty n00b
Joined: 10 Mar 2015 Posts: 1
|
Posted: Tue Mar 10, 2015 10:17 am Post subject: Choose the index of an array |
|
|
Hi everyone,
I'm searching a way to define a value of my array as the index of this same array.
I don't know if it is clear, so here is an example:
Current state:
Code: | Array (
[0] => Array ( [id] => 0 [name] => All [parent_id] => 5 )
[1] => Array ( [id] => 34 [name] => Example 1 [parent_id] => 2 )
[2] => Array ( [id] => 53 [name] => Example 2 [parent_id] => 11 )
[3] => Array ( [id] => 61 [name] => Example 3 [parent_id] => 2 )
) |
Desired state:
Code: | Array (
[0] => Array ( [name] => All [parent_id] => 5 )
[34] => Array ( [name] => Example 1 [parent_id] => 2 )
[53] => Array ( [name] => Example 2 [parent_id] => 11 )
[61] => Array ( [name] => Example 3 [parent_id] => 2 )
) |
I use the CMS Booked (phpScheduleIt) and the array is coming from a decoded JSON.
Is there any way to do this? Or is there any way to select the array line which has id = X?
Thanks in advance! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|