Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I need to pull the ShipQty from each of the following STDClass Objects and insert it into a new array.

Array ( [0] => stdClass Object ( [PRODUCTID] => 2 [ORDERID] => 7 [SHIPQTY] => 3 [STATUS] => 1 [SHIPDATE] => 2013-12-18 ) [1] => stdClass Object ( [PRODUCTID] => 2 [ORDERID] => 5 [SHIPQTY] => 2 [STATUS] => 1 [SHIPDATE] => 2014-01-02 ) [2] => stdClass Object ( [PRODUCTID] => 2 [ORDERID] => 2 [SHIPQTY] => 5 [STATUS] => 1 [SHIPDATE] => 2014-01-08 ) [3] => stdClass Object ( [PRODUCTID] => 2 [ORDERID] => 1 [SHIPQTY] => 2 [STATUS] => 1 [SHIPDATE] => 2014-01-16 ) )

I want the following: array(3,2,5,2)

Thank you in advance!

share|improve this question
    
Please show us what you've tried so far. –  Luceos Jan 20 at 18:50
    
@Luceos I've tried exactly what Emissary has posted below but not been able to get it working. –  user2436953 Jan 20 at 19:18

1 Answer 1

up vote 0 down vote accepted

try this (assuming your array is named $myArr):

$result = array();
foreach ($myArr as $obj) {
    $result[] = $obj->SHIPQTY;
}

Hope this helps.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.