PVConversions is a class used to convert one data type to another.
Often there will be requirements for converting data such as array to objects, json to xml, etc. This class is designed to have built-in functions to make those conversations easy.
Example:
//Create an array
$data = $array('Apple', 'Bananna', 'Orange');
//Convert the array to object
$data = PVConversions::arrayToObject($data);
//Will display an stdObject
print_r($data);
| package |
data |
|---|
arrayToObject(array $data) : \stdClass
| access |
public |
|---|
arrayAn array of data
\stdClass$data The return array in an object format
convertTextBoolean(string $boolean) : boolean
stringThe boolean as a string
boolean
objectToArray(object $object) : array
| access |
public |
|---|
objectAn object
array$array, The passed object in array formart/
xmlToArray( $xml) : array
| access |
public |
|---|
array$array The xml documented converted into an array