Jump to content

Nasty Parse Error


Hrky

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

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;
    }
Link to comment
https://forums.phpfreaks.com/topic/297348-nasty-parse-error/#findComment-1516700
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.