CRAIG
CRAIG

Reputation: 1029

Confusing with a php variable issue

In the below code, after the preg_match, $videoinfo['video']['rendering'] most definitely equals "Progressive".

So, I am expecting the final echo to output "Rendering: Progressive Scan".

However, it doesn't. It outputs "Rendering: Progressive" Am I missing something obvious here?

Thanks for your help!

if(preg_match("/^Video Field Order\s+:(.*)$/im",$output,$matches)){
    $videoinfo['video']['rendering'] = $matches[1];
    if($videoinfo['video']['rendering'] == "Progressive"){              
        $videoinfo['video']['rendering'] = 'Progressive Scan';                      
    }               
    echo("Rendering: " . $videoinfo['video']['rendering']);
}

Upvotes: 0

Views: 77

Answers (1)

Nanne
Nanne

Reputation: 64399

You do this

echo("Rendering: " . $videoinfo['video']['rendering']);

and you say that It outputs "Rendering: Progressive."

That means that $videoinfo['video']['rendering'] contains the string Progressive.. Mind the dot!

So it has 1 character extra (the dot), and that's why your equals doesn't work.

Upvotes: 3

Related Questions