-
-
Save gadiener/380477cb205aa151e8d02d61fe4a4373 to your computer and use it in GitHub Desktop.
[CAFFEINA] Exercise #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "tree.php"; | |
$x = new Tree(); | |
$x->bacon = "Pancetta"; | |
$x->pasta["fagioli"] = 3; | |
$y = clone $x; | |
$y->pasta = null; | |
$y->pasta->fagioli = [1]; | |
$y->alpha->beta->gamma = "Carote"; | |
var_dump($x,$y); | |
echo "\n$x\n$y"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Develop the class responsibile for the provided output in file : video.output.txt | |
*/ | |
class Tree {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object(Tree)#1 (2) { | |
["bacon"]=> | |
string(8) "Pancetta" | |
["pasta"]=> | |
object(Tree)#2 (1) { | |
["fagioli"]=> | |
int(3) | |
} | |
} | |
object(Tree)#3 (3) { | |
["bacon"]=> | |
string(8) "Pancetta" | |
["pasta"]=> | |
object(Tree)#4 (1) { | |
["fagioli"]=> | |
array(1) { | |
[0]=> | |
int(1) | |
} | |
} | |
["alpha"]=> | |
object(Tree)#5 (1) { | |
["beta"]=> | |
object(Tree)#6 (1) { | |
["gamma"]=> | |
string(6) "Carote" | |
} | |
} | |
} | |
{"bacon":"Pancetta","pasta":{"fagioli":3}} | |
{"bacon":"Pancetta","pasta":{"fagioli":[1]},"alpha":{"beta":{"gamma":"Carote"}}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment