0

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']);
}
5
  • 2
    Are you sure there isn't any trailing spaces in that string? Try trim($matches[1]); Commented Aug 26, 2013 at 6:55
  • 1
    That means the condition is not true, which means the string is not actually "Progressive". Likely some additional trailing whitespace or so. Commented Aug 26, 2013 at 6:56
  • 1
    could be extra space before or after 'Progressive' Commented Aug 26, 2013 at 6:57
  • Theres a .(dot) also after Progressive ? Commented Aug 26, 2013 at 6:59
  • Yes! There are trailing spaces. I knew there was a simple answer here somewhere. Thanks for helping me track that down!! Commented Aug 26, 2013 at 13:33

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

Good catch. There should not have been that dot there. Sorry for that confusion. Editing.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.