arrays test - PHP Online

Form of PHP Sandbox

Enter Your PHP code here for testing/debugging in the Online PHP Sandbox. As in the usual PHP files, you can also add HTML, but do not forget to add the tag <?php in the places where the PHP script should be executed.



Your result can be seen below.

Result of php executing





Full code of arrays test.php

  1. <?php
  2.    $OPTIONS_REQUIRED_KEYS = [
  3.         'session' => null,
  4.         'game' => null,
  5.         'transactionId' => null,
  6.         'amount' => null,
  7.         'subType' => null,
  8.         'roundId' => null
  9.     ];
  10.     
  11.     $options = [
  12.         'session'       => 'grgrrt5655',
  13.             'game'          => 'fthgfh8999ft',
  14.             'transactionId' => '7888888888',
  15.             'amount'        => 67,
  16.             'subType'       => 'bet',
  17.             'roundId'       => 777888999,
  18.     ];
  19.     if(!array_diff_key($options, $OPTIONS_REQUIRED_KEYS)) {
  20.         echo 'Same';
  21.     }
  22.     
  23.     print_r(array_fill_keys($OPTIONS_REQUIRED_KEYS, $options));
  24.     
  25.     var_dump(array_diff_key($options, $OPTIONS_REQUIRED_KEYS));
File Description
  • arrays test
  • PHP Code
  • 17 Dec-2020
  • 707 Bytes
You can Share it: