Skip to content

Tag: recursion

Recursive Search array with Multiple Needle – PHP

Array : Function : Concepts : Any user get access list to menu, If every user enter to not accessible uri param, decline it. Example : User John Doe have list menu Products (Full Access) Report (Full Access) Menu (Read Only) And John Doe opened https://localhost/dashboard/menu/create , by system decline it. Expectation : I want to search value dashboard/menu to

Convert PHP multidimentional array to multilevel menu using recursive?

I’m trying to create a PHP recursive function to create a multilevel menu from multi-dimentional array, but still failed. I have a data as such: So now I have a multi-dimentional array: My question is, how to produce final data as below: using PHP recursive function? I’ve been looking into several examples, but unfortunately the given solution and data sample/condition

PHP viewing folder content

I am trying to create a file server. What I am trying to do is -> on the page there will be lots of folders displayed, when you click on one you will be shown its content and if there is a folder inside of this folder you can click on it and it will display the content of that

Find all descendants in array

At first look it was a simple task, but when I tried to solve it I became confused. I have PHP array, where keys are top parent IDs, values are child IDs. Some child IDs have their own children. That children may have own children and so on. My goal is to get a new array, where all top parent

Use php function in php form

I am new in php, I am solving one task. Create a form with 2 text fields to enter only numbers (treat) and will mean number and power. After pressing the button the result is displayed on the same page, and the result is determined by recursive function in case you forget to enter a number, the number 2 will

PHP recursive function returning null array

I have a huge array in which keys are also not constant in most of the cases, but there are 3 keys that always constant (#name,#default_value,#value) and #default_value and #value is different i want to get these kind of sub arrays in 1 simple array , for this purpose i am using recursion in whole array and checking out if