Display the drop-down list

Test of define()

Example #1 : test success
Example #2 : test success
Example #3 : test success
Example #4 : test failed
Example #1
$input = [
  
=> 'CONSTANT',
  
=> 'Hello world.',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'bool' => true,
    
'is_defined' => false,
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #2
$input = [
  
=> 'GREETING',
  
=> 'Hello you.',
  
=> true,
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'bool' => true,
    
'is_defined' => true,
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #3
$input = [
  
=> 'E_ALL',
  
=> '123',
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'bool' => false,
  ],
  
'errors' => [
    
=> [
      
'code' => 8,
      
'message' => 'Constant E_ALL already defined',
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #4
$input = [
  
=> 'ARRAY',
  
=> [
    
=> 123,
  ],
]
$expected_output = [
  
'result' => [
    
'bool' => false,
  ],
  
'errors' => [
    
=> [
      
'code' => 2,
      
'message' => 'Constants may only evaluate to scalar values',
    ],
  ],
  
'php_version' => '5.6.8 WINNT i586',
]
$test_output = [
  
'result' => [
    
'bool' => true,
    
'is_defined' => false,
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]