Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

get std class value from an std classin php

stdClass Object
(
    [id_pro_alert] => 155
    [User_Id] => 252
    [Pro_Id] => 329
    [alertmethod] => daily
    [Alertname] => xcxv
    [name] => cyriac
    [email] => [email protected]
    [date] => 2016-21-10 09:20:26
    [mobile] => 
    [comments] => 
    [Alert_Id] => 329
    [Prop_Purpose] => lease
    [Min_Area] => 500
    [Max_Area] => 1000
    [Area_unit] => Sq.ft
    [Min_cost] => 1000
    [Max_cost] => 10000
    [City] => kochi
    [Create_Date] => 2016-10-17 12:59:14
    [Update_Date] => 2016-10-17 12:59:14
    [Status] => Active
    [0] => stdClass Object
        (
            [Prop_type] => Agricultural Land
        )

    [1] => stdClass Object
        (
            [Prop_type] => Office in IT park
        )

    [2] => stdClass Object
        (
            [Prop_type] => Business center
        )

)

How to get Prop_type value from stdclass

like image 352
cyriac Avatar asked Jun 29 '26 16:06

cyriac


1 Answers

Check this, You can access all Prop_type's

foreach($data as $key=>$row){
    if (is_int($key)) {
        echo $row->Prop_type;
    }
}

Create array of Prop_type's

$propData =array();
foreach($data as $key=>$row){
    if (is_int($key)) {
        $propData[] = $row->Prop_type;
    }
}
like image 155
Mak Avatar answered Jul 02 '26 06:07

Mak



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!