显示下拉菜单

Test of parse_ini_string() 本页面仅提供英文版本。

Example #1 : test success
Example #2 : test success
Example #1
$input = [
  
=> '[first_section]
            one = 1
            five = 5
            animal = BIRD

            [second_section]
            path = "/usr/local/bin"
            URL = "http://www.example.com/~username"

            [third_section]
            phpversion[] = "5.0"
            phpversion[] = "5.1"
            phpversion[] = "5.2"
            phpversion[] = "5.3"'
,
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'array' => [
      
'one' => '1',
      
'five' => '5',
      
'animal' => 'BIRD',
      
'path' => '/usr/local/bin',
      
'URL' => 'http://www.example.com/~username',
      
'phpversion' => [
        
=> '5.0',
        
=> '5.1',
        
=> '5.2',
        
=> '5.3',
      ],
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]
Example #2
$input = [
  
=> '[first_section]
            one = 1
            five = 5
            animal = BIRD

            [second_section]
            path = "/usr/local/bin"
            URL = "http://www.example.com/~username"

            [third_section]
            phpversion[] = "5.0"
            phpversion[] = "5.1"
            phpversion[] = "5.2"
            phpversion[] = "5.3"'
,
  
=> true,
]
$expected_output = $test_output
$test_output = [
  
'result' => [
    
'array' => [
      
'first_section' => [
        
'one' => '1',
        
'five' => '5',
        
'animal' => 'BIRD',
      ],
      
'second_section' => [
        
'path' => '/usr/local/bin',
        
'URL' => 'http://www.example.com/~username',
      ],
      
'third_section' => [
        
'phpversion' => [
          
=> '5.0',
          
=> '5.1',
          
=> '5.2',
          
=> '5.3',
        ],
      ],
    ],
  ],
  
'php_version' => '7.1.33 Linux x86_64',
]