1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2005
    Rep Power

    Subarray into single array

    I have a multi dimensional array.

    I want to take subarray 'style' and take the keys and put them into a new array.

    here is the array:

    array(7) {
    string(5) "Basic"
    string(4) "0763"
    string(4) "Info"
    array(3) {
    string(3) "pos"
    string(2) "first"
    string(0) ""
    array(4) {
    string(2) "15"
    string(2) "20"
    string(2) "55"
    string(2) "200"
    array(4) {
    string(0) ""
    string(0) ""
    string(0) ""
    string(0) ""

    how to get this result?.
    > $new_array = array( 'top' => '15', 'left' => '20', 'right' => '55', 'width' => '200')
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Rep Power
    Um, didn't you just write that down?

    PHP Code:
    That's your array (assuming $tab, $countTab and $countNode are correct). Now store it in your variable.
    The 6 worst sins of security ē How to (properly) access a MySQL database with PHP

    Why canít I use certain words like "drop" as part of my Security Question answers?
    There are certain words used by hackers to try to gain access to systems and manipulate data; therefore, the following words are restricted: "select," "delete," "update," "insert," "drop" and "null".

IMN logo majestic logo threadwatch logo seochat tools logo