How to "compact" vars into an object

Discussion in 'PHP' started by Weizheng, Apr 18, 2007.

  1. #1
    In PHP you can do something like

    $arr = compact('var1' , 'var2' , 'var3')
    PHP:
    and get an array filled with values of the specified variables.

    Is there a similar function to build an Object out of variables?

    Something like:

    $obj = compactObj('var1' , 'var2' , 'var3')
    PHP:
     
    Weizheng, Apr 18, 2007 IP
  2. chilli_source

    chilli_source Active Member

    Messages:
    58
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    61
    #2
    chilli_source, Apr 18, 2007 IP