using PRINT command and "+" to concatenate strings

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dave-o

    using PRINT command and "+" to concatenate strings

    New learner.

    For the print command and concatenation, the period is difficult for
    my afflicted eyes to see, but the "+" seems to work. Is this an
    accepted PHP convention?

    Thank you,
    David
  • Jerry Stuckle

    #2
    Re: using PRINT command and "+&quot ; to concatenate strings

    Dave-o wrote:
    New learner.
    >
    For the print command and concatenation, the period is difficult for
    my afflicted eyes to see, but the "+" seems to work. Is this an
    accepted PHP convention?
    >
    Thank you,
    David
    >
    Nope. + is addition, not concatenation.

    <?php
    print("abc" + "def"):
    ?>

    Result:

    0

    --
    =============== ===
    Remove the "x" from my email address
    Jerry Stuckle
    JDS Computer Training Corp.
    jstucklex@attgl obal.net
    =============== ===

    Comment

    • Dave-o

      #3
      Re: using PRINT command and &quot;+&quot ; to concatenate strings

      On Mar 3, 7:12 am, Dave-o <dave.a...@gmai l.comwrote:
      New learner.
      >
      For the print command and concatenation, the period is difficult for
      my afflicted eyes to see, but the "+" seems to work. Is this an
      accepted PHP convention?
      >
      Thank you,
      David
      =============== =======

      Follow-up...Note to self: No, it doesn't work!

      Hmmm....Is there anything other than a period that can be used for
      concatenation of strings when using the print command?

      Thanks,
      David

      Comment

      • Jerry Stuckle

        #4
        Re: using PRINT command and &quot;+&quot ; to concatenate strings

        Dave-o wrote:
        On Mar 3, 7:12 am, Dave-o <dave.a...@gmai l.comwrote:
        >New learner.
        >>
        >For the print command and concatenation, the period is difficult for
        >my afflicted eyes to see, but the "+" seems to work. Is this an
        >accepted PHP convention?
        >>
        >Thank you,
        >David
        >
        =============== =======
        >
        Follow-up...Note to self: No, it doesn't work!
        >
        Hmmm....Is there anything other than a period that can be used for
        concatenation of strings when using the print command?
        >
        Thanks,
        David
        >
        No. Period is the concatenation operator in PHP. And yes, it's hard
        for me to see, also. :-)

        --
        =============== ===
        Remove the "x" from my email address
        Jerry Stuckle
        JDS Computer Training Corp.
        jstucklex@attgl obal.net
        =============== ===

        Comment

        • Dave-o

          #5
          Re: using PRINT command and &quot;+&quot ; to concatenate strings

          On Mar 3, 6:51 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
          Dave-o wrote:
          On Mar 3, 7:12 am, Dave-o <dave.a...@gmai l.comwrote:
          New learner.
          >
          For the print command and concatenation, the period is difficult for
          my afflicted eyes to see, but the "+" seems to work. Is this an
          accepted PHP convention?
          >
          Thank you,
          David
          >
          =============== =======
          >
          Follow-up...Note to self: No, it doesn't work!
          >
          Hmmm....Is there anything other than a period that can be used for
          concatenation of strings when using the print command?
          >
          Thanks,
          David
          >
          No. Period is the concatenation operator in PHP. And yes, it's hard
          for me to see, also. :-)
          >
          --
          =============== ===
          Remove the "x" from my email address
          Jerry Stuckle
          JDS Computer Training Corp.
          jstuck...@attgl obal.net
          =============== ===
          Good to know. Thank you for the response. I'll go on squinting.

          David

          Comment

          • John Burton

            #6
            Re: using PRINT command and &quot;+&quot ; to concatenate strings

            "Dave-o" <dave.aman@gmai l.comwrote in message
            news:f1e64cb7-3adc-4aa1-915f-6d85b8278d04@f4 7g2000hsd.googl egroups.com...
            On Mar 3, 6:51 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
            >Dave-o wrote:
            On Mar 3, 7:12 am, Dave-o <dave.a...@gmai l.comwrote:
            >New learner.
            >>
            >For the print command and concatenation, the period is difficult for
            >my afflicted eyes to see, but the "+" seems to work. Is this an
            >accepted PHP convention?
            >>
            >Thank you,
            >David
            >>
            =============== =======
            >>
            Follow-up...Note to self: No, it doesn't work!
            >>
            Hmmm....Is there anything other than a period that can be used for
            concatenation of strings when using the print command?
            >>
            Thanks,
            David
            >>
            >No. Period is the concatenation operator in PHP. And yes, it's hard
            >for me to see, also. :-)
            >>
            >--
            >============== ====
            >Remove the "x" from my email address
            >Jerry Stuckle
            >JDS Computer Training Corp.
            >jstuck...@attg lobal.net
            >============== ====
            >
            Good to know. Thank you for the response. I'll go on squinting.
            Or find an editor font that has bigger ones in? I used to have such a thing
            but can't remember where I got it from, sorry.

            Comment

            • Rik Wasmus

              #7
              Re: using PRINT command and &quot;+&quot ; to concatenate strings

              On Mon, 03 Mar 2008 14:32:55 +0100, John Burton <john.burton@jb mail.com>
              wrote:
              "Dave-o" <dave.aman@gmai l.comwrote in message
              news:f1e64cb7-3adc-4aa1-915f-6d85b8278d04@f4 7g2000hsd.googl egroups.com....
              >On Mar 3, 6:51 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
              >>Dave-o wrote:
              >On Mar 3, 7:12 am, Dave-o <dave.a...@gmai l.comwrote:
              >>New learner.
              >>>
              >>For the print command and concatenation, the period is difficult
              >>for
              >>my afflicted eyes to see, but the "+" seems to work. Is this an
              >>accepted PHP convention?
              >>>
              >>Thank you,
              >>David
              >>>
              >============== ========
              >>>
              >Follow-up...Note to self: No, it doesn't work!
              >>>
              >Hmmm....Is there anything other than a period that can be used for
              >concatenatio n of strings when using the print command?
              >>>
              >Thanks,
              >David
              >>>
              >>No. Period is the concatenation operator in PHP. And yes, it's hard
              >>for me to see, also. :-)
              >>>
              >>--
              >>============= =====
              >>Remove the "x" from my email address
              >>Jerry Stuckle
              >>JDS Computer Training Corp.
              >>jstuck...@att global.net
              >>============= =====
              >>
              >Good to know. Thank you for the response. I'll go on squinting.
              >
              Or find an editor font that has bigger ones in? I used to have such a
              thing but can't remember where I got it from, sorry.
              With a descent adjustable syntax highlighter, you might be able to give it
              a particular color of your choice making it more noticable. UltraEdit does
              this fine for instance, I'm sure other editors should also be capable of
              this.
              --
              Rik Wasmus

              Comment

              • Michael Fesser

                #8
                Re: using PRINT command and &quot;+&quot ; to concatenate strings

                ..oO(Dave-o)
                >For the print command and concatenation, the period is difficult for
                >my afflicted eyes to see, but the "+" seems to work. Is this an
                >accepted PHP convention?
                Of course not, because it's a completely different operator.

                Micha

                Comment

                • Norman Peelman

                  #9
                  Re: using PRINT command and &quot;+&quot ; to concatenate strings

                  Dave-o wrote:
                  On Mar 3, 6:51 am, Jerry Stuckle <jstuck...@attg lobal.netwrote:
                  >Dave-o wrote:
                  >>On Mar 3, 7:12 am, Dave-o <dave.a...@gmai l.comwrote:
                  >>>New learner.
                  >>>For the print command and concatenation, the period is difficult for
                  >>>my afflicted eyes to see, but the "+" seems to work. Is this an
                  >>>accepted PHP convention?
                  >>>Thank you,
                  >>>David
                  >>============= =========
                  >>Follow-up...Note to self: No, it doesn't work!
                  >>Hmmm....Is there anything other than a period that can be used for
                  >>concatenati on of strings when using the print command?
                  >>Thanks,
                  >>David
                  >No. Period is the concatenation operator in PHP. And yes, it's hard
                  >for me to see, also. :-)
                  >>
                  >--
                  >============== ====
                  >Remove the "x" from my email address
                  >Jerry Stuckle
                  >JDS Computer Training Corp.
                  >jstuck...@attg lobal.net
                  >============== ====
                  >
                  Good to know. Thank you for the response. I'll go on squinting.
                  >
                  David

                  The only other option is to avoid it as much as necessary:

                  $str1 = 'Hello';
                  $str2 = 'world!';

                  echo "$str1 $str2";

                  or echo "{$str1} {$str2}"; // brackets do not show

                  or echo "'$str1 $str2'"; // to enclose a string in single quotes...

                  or $var = "<any of the above methods>";

                  ....take you pick. double quotes allow variables to be expanded, single
                  quotes do not. ;)

                  --
                  Norman
                  Registered Linux user #461062
                  -Have you been to www.php.net yet?-

                  Comment

                  • AnrDaemon

                    #10
                    Re: using PRINT command and &quot;+&quot ; to concatenate strings

                    Greetings, Dave-o.
                    In reply to Your message dated Monday, March 3, 2008, 15:12:20,
                    For the print command and concatenation, the period is difficult for
                    my afflicted eyes to see, but the "+" seems to work. Is this an
                    accepted PHP convention?
                    Try to play with text colors. I have better results with grey text on black background.


                    --
                    Sincerely Yours, AnrDaemon <anrdaemon@free mail.ru>

                    Comment

                    Working...