$a = '.sprintf($tv,'$aa').';
$b = '.sprintf($tv,'$bb').';
if ($a <> $b)
- return ($a ' . ($r[2] ? '>' : '<').' $b) ? -1 : 1;';
+ return ($a ' . ((isset($r[2]) and $r[2]) ? '>' : '<').' $b) ? -1 : 1;';
}
}
}
* @return array
*/
function inc_xml_to_array_dist($u) {
- return @ObjectToArray(new SimpleXmlIterator($u));
+ return @XMLObjectToArray(new SimpleXmlIterator($u));
+}
+
+/**
+ *
+ * object -> tableau
+ *
+ * @param object $object The object to convert
+ * @return array
+ *
+ */
+function inc_object_to_array( $object ) {
+ if( !is_object( $object ) && !is_array( $object ) ) {
+ return $object;
+ }
+ if( is_object( $object ) ) {
+ $object = get_object_vars( $object );
+ }
+ return array_map( 'inc_object_to_array', $object );
}
/**
throw new Exception('YQL: réponse vide ou mal formée');
return false;
}
- return (array) $w;
+ return inc_object_to_array($w);
}
/**
* @param Object $object
* @return array|bool
*/
-function ObjectToArray($object){
+function XMLObjectToArray($object){
$xml_array = array();
for( $object->rewind(); $object->valid(); $object->next() ) {
if(array_key_exists($key = $object->key(), $xml_array)){
foreach($vars['@attributes'] as $k => $v)
$xml_array[$key][$k] = $v;
if($object->hasChildren()){
- $xml_array[$key][] = ObjectToArray(
+ $xml_array[$key][] = XMLObjectToArray(
$object->current());
}
else{