cyriac cyriac - 1 month ago 9
PHP Question

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] => cyriac@tewve.com
[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

Answer

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;
    }
}
Comments