PHP: cannot matching string "<br />

Posted by Patrick on Stack Overflow See other posts from Stack Overflow or by Patrick
Published on 2010-05-16T15:01:55Z Indexed on 2010/05/16 15:10 UTC
Read the original article Hit count: 154

Filed under:

hi,

I'm having problems with string matching in PHP.

I've 2 html elements in my page, I've copy pasted here the content with Firebug

<div class="field-item odd">
     <div class="field-label-inline-first">
              Year:</div>
                    2009        </div>


<div class="field-item odd">
    <div class="field-label-inline-first">
                                  Synopsis:</div>
                                        &lt;br /&gt;
                            </div>

This php line works perfectly (the element with 2009 is detected)

<?php if ($items[0]['view'] == '2009') : echo "ok"; ?>

However I'm not able to match the string containing
element:

<?php if ($items[0]['view'] == '<br />') : echo "ok"; ?> //doesn't work
<?php if ($items[0]['view'] == '&lt;br /&gt;') : echo "ok"; ?> //again doesn't work

any tip ?

To give you some context: The strings are produced by CKEditor, an editor I'm using in my Drupal back-end. When I leave empty this editor, the
tag is displayed on the string as plain text (because I set "plain text" as formatting option in the back-end)

Thanks

© Stack Overflow or respective owner

Related posts about php