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

  • SEARCH
  • Home
  • 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 7420339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:13:16+00:00 2026-05-29T08:13:16+00:00

echo 1 . (print ‘2’) + 3; returns 214. How does the script end

  • 0

echo "1" . (print '2') + 3; returns 214. How does the script end up with *14?

  • 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-29T08:13:17+00:00Added an answer on May 29, 2026 at 8:13 am

    When you do

    echo "1" . (print '2') + 3;
    

    PHP will do (demo)

    line     # *  op                           fetch          ext  return  operands
    ---------------------------------------------------------------------------------
       2     0  >   PRINT                                            ~0      '2'
             1      CONCAT                                           ~1      '1', ~0
             2      ADD                                              ~2      ~1, 3
             3      ECHO                                                     ~2
             4    > RETURN                                                   1
    

    In words:

    • print 2, return 1
    • concat “1” with returned 1 => “11”
    • add “11” + 3 => 14
    • echo 14

    and that’s 214.

    The operators + - . have equal Operator Precedence, but are left associative:

    For operators of equal precedence, left associativity means that evaluation proceeds from left to right, and right associativity means the opposite.


    Edit: since all the other answers claim PHP does 1+3, here is further proof that it doesnt:

    echo "1" . (print '2') + 9;
    

    gives 220, e.g. 11+9 and not 1 . (1+9). If the addition had precedence over the concatenation, it would have been 2110, but for that you’d had to write

    echo "1" . ((print '2') + 9);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

PHP Echo or Print functions does not show anything when php is busy with
Linux bash script: function Print() { echo $1 } Print OK This script runs
Linux bash script: #!/bin/bash function Print() { echo $1 } var=* Print $var Execution
Im writing a login script. My db.php doesnt echo/print anything so why doesnt header(Location:
How do I exclude what my script is doing and only have echo's print?
Possible Duplicate: Reference: Comparing PHP's print and echo Is there any major and fundamental
market_l=${echo $1 | awk '{print tolower($0)}'} echo $market_l when i execute this its giving
print <ul>; foreach ($arr as $value) { echo(<li> . $value[storeid] . . ($value[dvdstock] +
I understand that echo is slightly faster, and print can be used as a
Given the following command, echo "1: " | awk '/1/ -F ":" {print $1}'

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.