1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

preg_replace error - may be fixed

Discussion in 'PHP' started by David Ledger, Oct 21, 2010.

  1. David Ledger

    David Ledger New Member

    Joined:
    Oct 21, 2010
    Messages:
    10
    Likes Received:
    5
    Trophy Points:
    0
    Location:
    Gloucester UK
    I have PHP 5.3.2 on my Mac, but my ISP has PHP 5.2.9

    I'm looking for confirmation of my problem in 5.2.9 so that I can try to get my ISP to upgrade.

    I see the problem on my site at the ISP, but not with interactive php use on my Mac.

    The problem:

    PHP:
    Apply
    preg_replace
    ('/^[^\%]*(\%[^\%]+\%).*/''$1'$cell)
    where $cell contains (there is a single space at beginning and end)
     
    valign="top" style="text-align:right; width:75px;"><class="f-lp">%Price%</p
    and 
    you get
    %Price%
    but if $cell contains (there is a single space at beginning and end)
     
    valign="top" style="text-align:right; width:75px;"><class="f-lp">%LineTotal%</p> </td
    then you get
    %LineTotal% </td
    (
    which has a space on the end).
    I've tried various fiddles and variants, but can't get rid of the trailing <space></td> in the second case when using my ISP's PHP.

    Please forgive the mix of code and non-code in the CODE block.

    David
     

Share This Page