array_push...cant push both key & value !!

Discussion in 'PHP' started by dracula51, Jun 7, 2010.

  1. #1
    I tried like this:

    $abc = array();
    foreach($_POST as $key => $value){
        array_push($abc, $key => $value)
    }
    PHP:

    i think the problem is in 3rd line....array_push just accept a value NOT both key & value together
    how can i solve it
    or is there any other way ??

    help plz
     
    dracula51, Jun 7, 2010 IP
  2. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #2
    It's late so maybe I am underthinking this, but how about:

    $abc=$_POST;
    PHP:
     
    plog, Jun 7, 2010 IP
  3. dracula51

    dracula51 Peon

    Messages:
    146
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    damn that is the easiest way & i completely forgot that
    tnx man :)
     
    dracula51, Jun 7, 2010 IP