配列を比較して対応関係を見つけます
配列 a:
<br />$a = array (<br /> 0 => <br /> array (<br /> 'packageno' => 'S2Y140805025',<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4212',<br /> ),<br /> 1 => <br /> array (<br /> 'packageno' => 'S2Y140805025',<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4214',<br /> ),<br /> 2 => <br /> array (<br /> 'packageno' => 'SYS140804073',<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4212',<br /> ),<br /> 3 => <br /> array (<br /> 'packageno' => 'SYS140804073',<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4213',<br /> ),<br /> 4 => <br /> array (<br /> 'packageno' => 'SYS140731064',<br /> 'type' => 'ECS1-713',<br /> 'cust_no' => '12657727',<br /> 'lotno' => '4154',<br /> ),<br /> 5 => <br /> array (<br /> 'packageno' => 'SYS140731064',<br /> 'type' => 'ECS1-713',<br /> 'cust_no' => '12657727',<br /> 'lotno' => '4210',<br /> ),<br /> 6 => <br /> array (<br /> 'packageno' => 'SYS140801090',<br /> 'type' => 'ECS1-713',<br /> 'cust_no' => '12657727',<br /> 'lotno' => '4200',<br /> ),<br /> 7 => <br /> array (<br /> 'packageno' => 'SYS140801090',<br /> 'type' => 'ECS1-713',<br /> 'cust_no' => '12657727',<br /> 'lotno' => '4210',<br /> ),<br />);<br />
<br />$b = array (<br /> 0 => <br /> array (<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4211',<br /> ),<br /> 1 => <br /> array (<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4212',<br /> ),<br /> 2 => <br /> array (<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4213',<br /> ),<br /> 3 => <br /> array (<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4214',<br /> ),<br /> 4 => <br /> array (<br /> 'type' => 'ECS0-235',<br /> 'cust_no' => '12654172',<br /> 'lotno' => '4216',<br /> ),<br /> 5 => <br /> array (<br /> 'type' => 'ECS1-713',<br /> 'cust_no' => '12657727',<br /> 'lotno' => '4154',<br /> ),<br /> 6 => <br /> array (<br /> 'type' => 'ECS1-713',<br /> 'cust_no' => '12657727',<br /> 'lotno' => '4200',<br /> ),<br /> 7 => <br /> array (<br /> 'type' => 'ECS1-713',<br /> 'cust_no' => '12657727',<br /> 'lotno' => '4210',<br /> ),<br />);<br />
function foo($a, $ b ) {<br> foreach($a as $v) {<br> $c[] = array_search($v, $b);<br> }<br> for($i=1; $i<count></count> if(abs($c[$i] - $c[$i-1]) != 1) {<br> return '不連続';<br> } <br> }<br> return 'continuous';<div class="clear"></div>