1

I have multidimensional array that is dynamically generated using some another function. The multidimensional array consists of 3-d and 4-d elements. I have added example of array below. Now user wants to set particular value of this array by passing only keys of the array (as user will not have access of this array directly). So I need method to access particular element of array by using the keys passed by user. Please let me know. Thanks in advance.

User will pass something like e.g. $newdata["company"]["logo"]["data"] = "newlogourl";` and this value needs to be replaced in the original array.

Array
(
    [company] => Array
        (
            [logo] => Array
                (
                    [data] => https://www.sparksuite.com/images/logo.png
                    [style] => width:100%; max-width:300px
                )

            [name] => Array
                (
                    [data] => Company Name, Inc
                )

            [tagline] => Array
                (
                    [data] => Company Name, Inc
                )

        )

    [invoice] => Array
        (
            [no] => Array
                (
                    [data] => DY-13123
                    [label] => Invoice No: 
                    [style] => font-size:14px
                )

            [date] => Array
                (
                    [data] => 01-12-2018
                    [label] => Date: 
                )

            [total_due] => Array
                (
                    [data] => $56,890.23
                    [label] => Total Due: 
                    [display] => show
                )

        )

    [from] => Array
        (
            [name] => Array
                (
                    [data] => Apple Test Inc 
                )

            [address1] => Array
                (
                    [data] => 123 Seatle
                )

            [address2] => Array
                (
                    [data] => New jersy
                )

            [city] => Array
                (
                    [data] => Indore
                )

            [state] => Array
                (
                    [data] => M.P
                )

        )

    [to] => Array
        (
            [name] => Array
                (
                    [data] => American Option
                )

            [address1] => Array
                (
                    [data] => 205, Apollo Tower, Near Palasia
                )

            [address2] => Array
                (
                    [data] => Opp. 56 Shops, M.G Road
                )

            [city] => Array
                (
                    [data] => Indore
                )

            [state] => Array
                (
                    [data] => M.P
                )

        )

    [payment] => Array
        (
            [method] => Array
                (
                    [data] => DY-13123
                    [label] => Payment methods: 

                )

            [note] => Array
                (
                    [data] => Thank you for Business with us!
                    [label] => 
                )

        )

    [footer] => Array
        (
            [note] => Array
                (
                    [data] => Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s.
                    [label] => Terms and Conditions: 

                )

        )

    [itemcount] => Array
        (
            [count] => Array
                (
                    [label] => Sno.
                )

            [display] => show
        )

    [header] => Array
        (
            [style] => font-size:18px
            [display] => show
        )

)

0 Answers0