Advertisement
RahmanIEN

operator array

Jun 22nd, 2023 (edited)
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.58 KB | Source Code | 0 0
  1. <?php
  2. $array1 = [1, 2, 3];
  3. $array2 = [4, 5, 6];
  4. $mergedArray = $array1 + $array2;
  5. print_r($mergedArray);
  6. // Output yang akan dihasilkan:
  7. //Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 )
  8. ?>
  9. <?php
  10. $array1 = [1, 2, 3];
  11. $array2 = [1, 2, 3];
  12. if ($array1 == $array2) {
  13.     echo "Arrays nya sama";
  14. } else {
  15.     echo "Arrays nya tidak sama";
  16. }
  17. // Output: Arrays nya sama
  18. ?>
  19. <?php
  20. $array1 = [1, 2, 3];
  21. $array2 = [1, 2, 3];
  22. if ($array1 === $array2) {
  23.     echo "Arrays identik";
  24. } else {
  25.     echo "Arrays tidak identik";
  26. }
  27. // Output: Arrays tidak identik
  28. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement