Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Debug ! Debug!!! Debug!!!! Error: PHP Notice: Undefined offset: list ($date, $temperature) = split('[ ]', $Copymember[$x]); In line 67 if ($cartAKey[$x] == $cartBKey[$y] && $cartAValue[$x]

Debug !

Debug!!!

Debug!!!!

Error:

PHP Notice: Undefined offset:list ($date, $temperature) = split('[ ]', $Copymember[$x]); In line 67

if ($cartAKey[$x] == $cartBKey[$y] && $cartAValue[$x] === $cartBValue[$y]) { in line 84

/**  * Created by PhpStorm.  * User: zhongbojun  * Date: 2018/6/6  * Time: ??1:29  */ $filenamae1 = ""; $filenamae2 = ""; if ("$argv[1]" == "input001.a.txt"){ $filenamae1 = "input003.a.txt"; $filenamae2 = "input003.b.txt"; }else{ $filenamae1 = "$argv[1]"; $filenamae2 = "$argv[2]"; } $file = fopen("$filenamae1", "r"); $i = 0; $line_of_text = ""; while (!feof($file)) { $line_of_text .= fgets($file); } $members = explode(" ", $line_of_text); fclose($file); $file1 = fopen("$filenamae2", "r"); $i = 0; while (!feof($file1)) { $line_of_text .= fgets($file1); } $members1 = explode(" ", $line_of_text); fclose($file1); $cartAKey = array(); $cartAValue = array(); $cartBKey = array(); $cartBValue = array(); $index =0; for ($x = 0; $x < (sizeof($members1)); $x++) { if (my_is_int($members1[$x])) { if ($x == 0) { $index = $members1[0]; unset($members1[$x]); } else { unset($members1[$x]); } } } $Copymember = array(); $Copymember = array_values($members1); for ($x = 0; $x < (sizeof($Copymember)); $x++) { if ($x < $index) { list ($date, $temperature) = split('[ ]', $Copymember[$x]); // << good array_push($cartAKey, $date); array_push($cartAValue, $temperature); } else { try { list ($date, $temperature) = split('[ ]', $Copymember[$x]); // << good array_push($cartBKey, $date); array_push($cartBValue, $temperature); }catch (Exception $e){ } } } $difference = sizeof($members1) - $index; for ($x = 0; $x < $index; $x++) { for ($y = 0; $y < $difference; $y++) { try { if ($cartAKey[$x] == $cartBKey[$y] && $cartAValue[$x] === $cartBValue[$y]) { unset($cartAKey[$x]); // unset 3rd element unset($cartBKey[$y]); // unset 3rd element unset($cartAValue[$x]); // unset 3rd element unset($cartBValue[$y]); // unset 3rd element } } catch (Exception $e) { } } } $copyAkey = array_values($cartAKey); $copyAvalue = array_values($cartAValue); $copyBkey = array_values($cartBKey); $copyBvalue = array_values($cartBValue); for ($x = 0;$x<(sizeof($copyAkey));$x++){ for ($y = 0;$y<(sizeof($copyBkey));$y++) { if ($copyAkey[$x] == $copyBkey[$y]) { echo "Inconsistent Data (", $copyAkey[$x], "): A: ", $copyAvalue[$x], " B: ", $copyBvalue[$y]; echo " "; unset($cartAKey[$x]); // unset 3rd element unset($cartBKey[$y]); // unset 3rd element unset($cartAValue[$x]); // unset 3rd element unset($cartBValue[$y]); // unset 3rd element } } } $SB = array_values($cartAKey); $SB1 = array_values($cartBKey); for ($x = 0;$x<(sizeof($SB));$x++){ echo "Missing Data (", $SB[$x], " in data set A but not in B"; echo " "; } for ($x = 0;$x<(sizeof($SB1));$x++){ echo "Missing Data (", $SB1[$x], " in data set B but not in A"; echo " "; } function my_is_int($var) { if (!is_numeric($var) || (int) $var != (float) $var) { return false; } else { return true; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Computer Aided Database Design

Authors: Antonio Albano, Valeria De Antonellis, A. Di Leva

1st Edition

0444877355, 978-0444877352

More Books

Students also viewed these Databases questions

Question

How flying airoplane?

Answered: 1 week ago