Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // name, damage, durability
- $weaponSet1 = [
- ["Sword", 15, 80],
- ["Scythe", 35, 10],
- ["Club", 5, 40],
- ];
- $json = json_encode($weaponSet1);
- file_put_contents("output.json", $json);
- echo "RANDOM = ".$random = random_int(0,1)."<br>";
- if ($random != 0) {
- $ranndomChoise = random_int(0,2);
- $weaponSet2 = [
- ["Immortal King blade", 700, 100],
- ["Nova", 1400, 0],
- ["Death Touch", 5000, 0],
- ];
- array_push($weaponSet1, $weaponSet2[$ranndomChoise]);
- $json = json_encode($weaponSet1);
- file_put_contents("output2.json", $json);
- }
- if (file_exists("output2.json")) {
- $str1 = file_get_contents("output.json");
- $str2 = file_get_contents("output2.json");
- $arr1 = json_decode($str1);
- $arr2 = json_decode($str2);
- var_dump($arr1);
- echo "<br>";
- echo "<br>";
- var_dump($arr2);
- echo "<br>";
- echo "<br>";
- echo "<br>";
- $df = array_diff($arr1,$arr2);
- print_r($df);
- }
Add Comment
Please, Sign In to add comment