Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 731019
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T06:58:42+00:00 2026-05-14T06:58:42+00:00

I am a PHP beginner and saw on the forum this PHP expression: My

  • 0

I am a PHP beginner and saw on the forum this PHP expression:

My PHP version is 5.2.X ()

$regex = <<<'END'
/
  ( [\x00-\x7F]                 # single-byte sequences   0xxxxxxx
  | [\xC0-\xDF][\x80-\xBF]      # double-byte sequences   110xxxxx 10xxxxxx
  | [\xE0-\xEF][\x80-\xBF]{2}   # triple-byte sequences   1110xxxx 10xxxxxx * 2
  | [\xF0-\xF7][\x80-\xBF]{3}   # quadruple-byte sequence 11110xxx 10xxxxxx * 3 
  )
| ( [\x80-\xBF] )               # invalid byte in range 10000000 - 10111111
| ( [\xC0-\xFF] )               # invalid byte in range 11000000 - 11111111
/x
END;

Is this code correct? What do these strange (for me) constructions like <<<, 'END', /, /x, and END; mean?

My PHP version does not support nowdoc, how should I replace this expression? without quotes 'END' $regex became NULL

I recieve:

Parse error: syntax error, unexpected
T_SL in
/home/vhosts/mysite.com/public_html/mypage.php
on line X

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T06:58:42+00:00Added an answer on May 14, 2026 at 6:58 am

    Parse error: syntax error, unexpected
    T_SL in
    /home/vhosts/mysite.com/public_html/mypage.php
    on line X

    This comes from the ‘s around END. This is called nowdoc, which was added in PHP 5.3. Since you’re using PHP 5.2, and this regex uses ‘\x’, you’ll need a quoted string or you’ll need to escape the ‘\’s.

    An example of the regex as a quoted string, used in this answer:

    $regex = '/
    ( [\x00-\x7F]                 # single-byte sequences   0xxxxxxx
      | [\xC0-\xDF][\x80-\xBF]      # double-byte sequences   110xxxxx 10xxxxxx
      | [\xE0-\xEF][\x80-\xBF]{2}   # triple-byte sequences   1110xxxx 10xxxxxx * 2
      | [\xF0-\xF7][\x80-\xBF]{3}   # quadruple-byte sequence 11110xxx 10xxxxxx * 3
      )
    | ( [\x80-\xBF] )               # invalid byte in range 10000000 - 10111111
    | ( [\xC0-\xFF] )               # invalid byte in range 11000000 - 11111111
    /x
    ';
    

    The “/” and “/x” portions are control characters in the regex. The “/”s mark the beginning and end, and the meaning of the x flag (PCRE_EXTENDED) is defined in: http://us.php.net/manual/en/reference.pcre.pattern.modifiers.php

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am beginner in PHP. I am trying to parse this xml file. <relationship>
I am a beginner in PHP and SQL. Maybe this is a silly question,
I consider myself as a php beginner, so it may be possible that this
I'm a beginner in PHP I was wondering if this is easy to do
I'm a PHP beginner. I don't see the answer to this question in the
i am a beginner in PHP.I have this query in my code. $qsq =
PHP beginner here. Apologies if this has been posted in another form - I've
This is probably pretty basic, but I'm a beginner in PHP - I have
beginner PHP programmer here trying to use the mailchimp API... I keep getting this
I'm practicing my beginner php skills and would like to know why this script

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.