Jump to content

Second Eye


ainoy31

Recommended Posts

Hello-

I need help determine why this code is not working.  Seems like my logic is correct.  So, I have two arrays:

#1 - Array
(
    [0] => Array
        (
            [0] => Del Date/Time:01/31/08
        )

    [1] => Array
        (
            [0] => Del Date/Time
        )
    [2] => Array
        (
            [0] => 01/31/08
        )
)

#2 - Array
(
    [0] => Array
        (
            [0] => Cur Status:Delivered
        )

    [1] => Array
        (
            [0] => Delivered
        )
)

 

 

Here is my code that I need help with:

if(stristr($line, 'Del Date/Time:'))
{
$pat = '#(Del Date/Time):.*?(\d{2}/\d{2}/\d{2})#is';
preg_match_all($pat, $line, $matches);
$deliv_date = date("Y-m-d", strtotime( $matches[2][0] ) );
$delivered = true;
}//end of if(stristr($line, 'Del Date/Time:'))
if(stristr($line, 'Cur Status:'))
{
$pat = '~Cur Status:\</td\><td class="text" width=\'90\' bgcolor=\'#f5f5dc\'\>((??!\</td\>).)+)\</td\>~s';
preg_match_all($pat, $line, $matches);
$status = $matches[1][0];
if($status != 'Delivered')
{
$deliv_date = null;
$delivered = false;
}
}
return array($delivered, false, $status, $deliv_date);

 

The problem is that if status does not equal 'Delivered', then it should not set the $deliv_date to null and $delivered to false.  However, in my case it does and overwrites the previous $deliv_date value.  Right, if $status does not equal 'Delivered', then $deliv_date = null; and $delivered = false; should not be executed?  I hope this is pretty clear.  Maybe I am overlooking something simply here.  Much appreciation.

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.