title: using variable on T_OBJECT_OPERATOR php
body: <p>Basically im trying to parse an stdClass object heres the code I use:</p>
  
  <pre><code>while($row = $data-&gt;fetch_assoc()){
              try{
                  $products = $client-&gt;product_by_category_web_list($row['category_id'] , true, '', '2013-01-01', 0, 1500);
              }catch(SoapFault $e){
                  echo "No Products under this Category";
              }
  
  
              $i = 0;
  
              foreach($product as $products-&gt;item){
  
                  $cat_id = $row['category_id'];
                  $id = $product-&gt;$i-&gt;id;
                  $name = $product-&gt;$i-&gt;name;
                  $desc = $product-&gt;$i-&gt;descrShort;
                  $descLong = $product-&gt;$i-&gt;descrLong;
                  $avail = $product-&gt;$i-&gt;availableToSell;
                  $deliverable = $product-&gt;$i-&gt;deliverable;
                  $itemWeight = $product-&gt;$i-&gt;itemWeight;
                  $typelkp = $product-&gt;$i-&gt;typeLkp;
                  $stkbrandid = $product-&gt;$i-&gt;stkBrandId;
                  $dataVatId = $product-&gt;$i-&gt;dataVatId;
  
                  $query = "INSERT INTO `products` (`product_id` , `product_name` , `product_short_desc` , `product_long_desc` , `product_available , product_deliverable` , `product_item_weight` , `type_id` , `brand_id` , `vat_id`) 
                  VALUES (? , ? , ? , ? , ? , ? , ? , ? , ? , ?)";
  
                  $stmt = $mysql-&gt;prepare($query);
  
                  $stmt-&gt;bind_param("isssiiiiii" , $id , $name , $desc , $descLong , $avail , $deliverable , $itemWeight , $typelkp , $stkbrandid , $dataVatId);
  
                  $stmt-&gt;execute();
  
                  $mctp = "INSERT INTO `products_categories` (`product_id` , `category_id` , `row_updated`)
                  VALUES (? , ? , ?)";
  
                  $match = $mysql-&gt;query($mctp);
  
                  $match-&gt;bind_param("iii" , $id , $cat_id , 0);
  
                  $match-&gt;execute();
  
                  $i++;
              }
  
  
          }
  </code></pre>
  
  <p>the Soap Call returns this:</p>
  
  <pre><code>object(stdClass)#1 (1) {
    ["item"]=&gt;
    array(2) {
      [0]=&gt;
      object(stdClass)#3 (10) {
        ["id"]=&gt;
        int(79493)
        ["name"]=&gt;
        string(34) "Claud Butler Phobos Kids Bike 2014"
        ["descrShort"]=&gt;
        string(0) ""
        ["descrLong"]=&gt;
        string(1269) "
  This year we have worked harder than ever to offer you a great range of quality junior bikes. All exclusively designed and tested in the UK with todays young riders and the popularity of cycling foremost in our minds.
  
  
  A great bike is the key to a positive riding experience, enjoyment and reliability can be the largest factors when considering your new bike and with over 130 years of design and manufacturing experience we have become the brand of family cycling. Bikes have very much become a fashion item and we believe the kids choices are as important as Mum and Dads so we have a vast range of eye catching models to choose from. We also offer alloy and steel framed models to suit all budgets while maintaining great quality and performance at great value.
  
  
  
  
  
  Frame: HiTen Steel
  
  
  Fork: Rigid Steel
  
  
  Headset: Steel with bearings
  
  
  Bars: Steel
  
  
  Stem: Steel Quill Type
  
  
  Chainset: Steel
  
  
  Front Brake: Alloy V Rear
  
  
  Brake: Alloy V
  
  
  Rims: Alloy
  
  
  Front Hub: Steel
  
  
  Rear Hub: Steel
  
  
  Tyres: 20 x 1.95 Front, 20 x 1.95 Rear
  
  
  Seatpost: Steel
  
  
  "
        ["availableToSell"]=&gt;
        bool(true)
        ["deliverable"]=&gt;
        bool(true)
        ["itemWeight"]=&gt;
        float(20)
        ["typeLkp"]=&gt;
        int(1)
        ["stkBrandId"]=&gt;
        int(136)
        ["dataVatId"]=&gt;
        int(1)
      }
      [1]=&gt;
      object(stdClass)#4 (10) {
        ["id"]=&gt;
        int(64223)
        ["name"]=&gt;
        string(45) "DiamondBack Accomplice Black 20 Inch BMX 2012"
        ["descrShort"]=&gt;
        string(0) ""
        ["descrLong"]=&gt;
        string(1514) "
  DiamondBack Accomplice Black 20 Inch BMX 2012 Introduction
  
  
  If there were laws to prevent us from providing you with pro-level quality in a complete at a suspiciously low price, the new Accomplice would have us doing some hard time. Fortunately for both of us; there aren't. The bike has, however spent some time on the drawing board over the last year. In addition to being cleaned up and simplified, the Accomplice also bolsters a new frame with Affix Bush BB, Affix 9T cassette rear hub, Affix tyres and Butted tapered forks and bars! Built in Germany by the world famous KHE bmx experts.
  
  
  Specification and Features of DiamondBack Accomplice Black 20 Inch BMX 2012
  
  
  
  
  Diamondback Ambigram CRMO 3 piece crank on Affix Mid Bush BB (red ano) with Affix Orbis Alloy 25T sprocket
  
  
  Rear U brake with soft compound pad and front caliper brake with alloy hinge levers
  
  
  Front KHE Big "V" rim on Affix Ting Hub, rear Alienation Black Sheep rim on Affix 9T Hub with Affix 2.1 Tyres
  
  
  Affix system stem with 2 piece butted handlebar 8" rise 28.8" width
  
  
  KHE Exhib Project 2 saddle/post combo
  
  
  Diamondback/KHE collaboration: Full 4130 Butted chromoly BMX frame with integrated head tube and Diamond "X" Brace, with full 4130 butted tapered chromoly BMX forks"
  
  
  DiamondBack Accomplice Black 20 Inch BMX 2012 is perfect for:
  
  
  
  
  Hitting the parks, jumps or a bit of street riding.
  
  "
        ["availableToSell"]=&gt;
        bool(true)
        ["deliverable"]=&gt;
        bool(true)
        ["itemWeight"]=&gt;
        float(15)
        ["typeLkp"]=&gt;
        int(1)
        ["stkBrandId"]=&gt;
        int(215)
        ["dataVatId"]=&gt;
        int(1)
      }
    }
  }
  </code></pre>
  
  <p>Whenever im using the foreach loop I get a error: Invalid Arguement supplied foreach. Im parsing it based on the answer ive just found:
  <a href="https://stackoverflow.com/questions/1522572/parsing-stdclass-object-data-in-php">Here</a></p>