Jump to content

Nasty Parse Error


Go to solution Solved by Ch0cu3r,

Recommended Posts

Please Help, im tired and cant seem to find the parse error, to me it seems fine but it is showing me it like on pic i attached

 

public function getBlock( $tag ){

 

//echo $tag;

preg_match (‚#<!-- START ‚. $tag . ‚ -->(.+?)<!-- END ‚.

$tag . ‚ -->#si', $this->content, $tor);

$tor = str_replace (‚<!-- START ‚. $tag . ‚ -->', „", $tor[0]);

$tor = str_replace (‚<!-- END ‚ . $tag . ‚ -->', „", $tor);

 

return $tor;

}

post-179318-0-29106300-1437209301_thumb.png

Link to comment
https://forums.phpfreaks.com/topic/297348-nasty-parse-error/
Share on other sites

  • Solution

Not sure why but you are using commas, where you should be using quotes, highlighted below

preg_match (‚#<!-- START ‚. $tag . ‚ -->(.+?)<!-- END ‚. $tag . ‚ -->#si', $this->content, $tor);
            ^            ^         ^                  ^         ^
            |            |         |                  |         |
            +------------+---------+ -----------------+---------+
                                   |
               These commas should be single quotes not commas
Link to comment
https://forums.phpfreaks.com/topic/297348-nasty-parse-error/#findComment-1516695
Share on other sites

Omg i feel so stupid now hahah

i fixed it thanks

if anyone is intersted here is the fixed code :)

Thanks again

 

public function getBlock( $tag )
    {
        preg_match ('#<!-- START '. $tag . ' -->(.+?)<!-- END '. $tag . ' -->#si', $this->content, $tor);
        
        $tor = str_replace ('<!-- START '. $tag . ' -->', "", $tor[0]);
        $tor = str_replace ('<!-- END '  . $tag . ' -->', "", $tor);
        
        return $tor;
    }
Edited by Hrky
Link to comment
https://forums.phpfreaks.com/topic/297348-nasty-parse-error/#findComment-1516700
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.