Hy, I'm looking for a way to create a GraphViz graph from php arrays. I have an associative multidimensional array from which I need to extract the keys and their corresponding values, and use them to create a graph. Example by 1D array:
$arr = ("dogs" => "4", "cats" => "3");
I need to extract the key "dogs" and use it as the label of a nod, and extract the corresponding value "4" and somehow use that to define the size of that nod. I need to do the same thing with multidimensional arrays. Just a silly example:
$md_arr = ("dogs" => array("rot" => "7", "blood_hound" => "4"),
"cats" => array("long_hair" => "12", "some_other_kind" => "1")
);
I need the output to be defined something like this:
name/label of the first node: first key from the first array => "dogs" name/label of the second node: first key from the second array => "rot" , size of that node is a value of the corresponding key - in this case "7".
I also need to know how to pass the variable from my array_script.php (script that creates my MD array) to a new script that will create the graph. I tried putting the example code for creating graph into my php script, and the output was a warning message stating:
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\test\hare.php:1) in C:\xampp\php\PEAR\Image\GraphViz.php on line 174
Can anyone please help me with this?