- array_search: documentation ( source)
<?php
$xml_object['executeCustomReportResponse']['reportDetail']['header']['columnName'] = array("Apple","Banana", "Carrot");
$xml_object['executeCustomReportResponse']['reportDetail']['header']['columnName']['RandomFlag'] =True;
echo("\nData Type: ".gettype ( $xml_object ));
echo("\n");
foreach($xml_object['executeCustomReportResponse']['reportDetail']['header']['columnName'] as $value){
echo($value." ");
}
$get_column_name = $xml_object['executeCustomReportResponse']['reportDetail']['header']['columnName'];
echo("\nData Type of copy ".gettype( $get_column_name ));
echo("\n");
foreach($get_column_name as $value){
echo($value." ");
}
echo("\n"."************"."\n");
function getGroupNames($xml_response){
global $ajax_data;
$index_of_title_column;
$index_of_group_type_column;
$columns_array = (array)$xml_response->executeCustomReportResponse->reportDetail->header->columnName;
$index_of_title_column = array_search("Apple", $columns_array);
$index_of_group_type_column = array_search("Carrot", $columns_array);
echo($index_of_title_column."\n");
echo($index_of_group_type_column."\n");
}
getGroupNames($xml_object)
?>