1--TEST-- 2Test parse_ini_file() function : variation: handling different boolean values 3--CREDITS-- 4Dave Kelsey <d_kelsey@uk.ibm.com> 5--FILE-- 6<?php 7echo "*** Testing parse_ini_file() : variation ***\n"; 8$output_file = __FILE__.".ini"; 9$iniFile = <<<FILE 10[section1] 11value1=on 12value2=off 13[section2] 14value1=true 15value2=false 16[section3] 17value1=yes 18value2=no 19[section4] 20value1=null 21value2= 22 23[section5] 24value1="on" 25value2="off" 26[section6] 27value1="true" 28value2="false" 29[section7] 30value1="yes" 31value2="no" 32[section8] 33value1="null" 34value2="" 35 36FILE; 37 38file_put_contents($output_file, $iniFile); 39 40$a = parse_ini_file($output_file, true); 41var_dump($a); 42unlink($output_file); 43?> 44--EXPECT-- 45*** Testing parse_ini_file() : variation *** 46array(8) { 47 ["section1"]=> 48 array(2) { 49 ["value1"]=> 50 string(1) "1" 51 ["value2"]=> 52 string(0) "" 53 } 54 ["section2"]=> 55 array(2) { 56 ["value1"]=> 57 string(1) "1" 58 ["value2"]=> 59 string(0) "" 60 } 61 ["section3"]=> 62 array(2) { 63 ["value1"]=> 64 string(1) "1" 65 ["value2"]=> 66 string(0) "" 67 } 68 ["section4"]=> 69 array(2) { 70 ["value1"]=> 71 string(0) "" 72 ["value2"]=> 73 string(0) "" 74 } 75 ["section5"]=> 76 array(2) { 77 ["value1"]=> 78 string(2) "on" 79 ["value2"]=> 80 string(3) "off" 81 } 82 ["section6"]=> 83 array(2) { 84 ["value1"]=> 85 string(4) "true" 86 ["value2"]=> 87 string(5) "false" 88 } 89 ["section7"]=> 90 array(2) { 91 ["value1"]=> 92 string(3) "yes" 93 ["value2"]=> 94 string(2) "no" 95 } 96 ["section8"]=> 97 array(2) { 98 ["value1"]=> 99 string(4) "null" 100 ["value2"]=> 101 string(0) "" 102 } 103} 104