PHP Concatenation Operators

Php tutorial index.

PHP Compensation Operator is used to combine character strings.

  • PHP Tutorial
  • PHP Exercises
  • PHP Calendar
  • PHP Filesystem
  • PHP Programs
  • PHP Array Programs
  • PHP String Programs
  • PHP Interview Questions
  • PHP IntlChar
  • PHP Image Processing
  • PHP Formatter
  • Web Technology
  • How to Concatenate Strings in PHP ?
  • How to Concatenate Strings in JavaScript ?
  • How to Concatenate Two Arrays in PHP ?
  • Concatenating Two Strings in C
  • Python - Concatenation of two String Tuples
  • String Concatenation in C++
  • String concatenation in Scala
  • String concatenation in Julia
  • Python String Concatenation
  • How to Optimize String Concatenation in Java?
  • String Concatenation in R Programming
  • How to Concatenate Multiple Strings in Java?
  • How to Concatenate Strings in Swift?
  • Shell Script to Concatenate Two Strings
  • Python - Horizontal Concatenation of Multiline Strings
  • Python - Triple quote String concatenation
  • Batch Script - String Concatenation
  • Concatenate Two Strings in R programming - paste() method
  • How to Append or Concatenate Strings in Dart?

Concatenation of two strings in PHP

There are two string operators. The first is the concatenation operator (‘ . ‘), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator (‘ .= ‘), which appends the argument on the right side to the argument on the left side. 

Code #1:  

Time complexity : O(n)  Auxiliary Space : O(n)

  Code #2 : 

  Code #3 :  

  Code #4 :

PHP is a server-side scripting language designed specifically for web development. You can learn PHP from the ground up by following this PHP Tutorial and PHP Examples .

Please Login to comment...

Similar reads.

  • Web Technologies

Improve your Coding Skills with Practice

 alt=

What kind of Experience do you want to share?

CodedTag

  • PHP String Operators

In PHP, string operators, such as the concatenation operator (.) and its assignment variant (.=), are employed for manipulating and concatenating strings in PHP. This entails combining two or more strings. The concatenation assignment operator (.=) is particularly useful for appending the right operand to the left operand.

Let’s explore these operators in more detail:

Concatenation Operator (.)

The concatenation operator (.) is utilized to combine two strings. Here’s an example:

You can concatenate more than two strings by chaining multiple concatenation operations.

Let’s take a look at another pattern of the concatenation operator, specifically the concatenation assignment operator.

Concatenation Assignment Operator (.=)

The .= operator is a shorthand assignment operator that concatenates the right operand to the left operand and assigns the result to the left operand. This is particularly useful for building strings incrementally:

This is equivalent to $greeting = $greeting . " World!"; .

Let’s see some examples

Examples of Concatenating Strings in PHP

Here are some more advanced examples demonstrating the use of both the concatenation operator (.) and the concatenation assignment operator (.=) in PHP:

Concatenation Operator ( . ):

In this example, the . operator is used to concatenate multiple strings and variables into a single string.

Concatenation Assignment Operator ( .=) :

Here, the .= operator is used to append additional text to the existing string in the $paragraph variable. It is a convenient way to build up a string gradually.

Concatenation Within Iterations:

You can also use concatenation within iterations to build strings dynamically. Here’s an example using a loop to concatenate numbers from 1 to 5:

In this example, the .= operator is used within the for loop to concatenate the current number and a string to the existing $result string. The loop iterates from 1 to 5, building the final string. The rtrim function is then used to remove the trailing comma and space.

You can adapt this concept to various scenarios where you need to dynamically build strings within loops, such as constructing lists, sentences, or any other formatted output.

These examples showcase how you can use string concatenation operators in PHP to create more complex strings by combining variables, literals, iterations and other strings.

Let’s summarize it.

Wrapping Up

PHP provides powerful string operators that are essential for manipulating and concatenating strings. The primary concatenation operator (.) allows for the seamless combination of strings, while the concatenation assignment operator (.=) provides a convenient means of appending content to existing strings.

This versatility is demonstrated through various examples, including simple concatenation operations, the use of concatenation assignment for gradual string construction, and dynamic string building within iterations.

For more PHP tutorials, visit here or visit PHP Manual .

Did you find this article helpful?

 width=

Sorry about that. How can we improve it ?

  • Facebook -->
  • Twitter -->
  • Linked In -->
  • Install PHP
  • Hello World
  • PHP Constant
  • PHP Comments

PHP Functions

  • Parameters and Arguments
  • Anonymous Functions
  • Variable Function
  • Arrow Functions
  • Variadic Functions
  • Named Arguments
  • Callable Vs Callback
  • Variable Scope

Control Structures

  • If-else Block
  • Break Statement

PHP Operators

  • Operator Precedence
  • PHP Arithmetic Operators
  • Assignment Operators
  • PHP Bitwise Operators
  • PHP Comparison Operators
  • PHP Increment and Decrement Operator
  • PHP Logical Operators
  • Array Operators
  • Conditional Operators
  • Ternary Operator
  • PHP Enumerable
  • PHP NOT Operator
  • PHP OR Operator
  • PHP Spaceship Operator
  • AND Operator
  • Exclusive OR
  • Spread Operator
  • Null Coalescing Operator

Data Format and Types

  • PHP Data Types
  • PHP Type Juggling
  • PHP Type Casting
  • PHP strict_types
  • Type Hinting
  • PHP Boolean Type
  • PHP Iterable
  • PHP Resource
  • Associative Arrays
  • Multidimensional Array

String and Patterns

  • Remove the Last Char
  • How to Concatenate Strings in PHP

Use the Concatenation Operator to Concatenation Strings in PHP

Use the concatenation assignment operator to concatenate strings in php, use the sprintf() function to concatenate strings in php.

How to Concatenate Strings in PHP

This article will introduce different methods to perform string concatenation in PHP.

The process of joining two strings together is called the concatenation process. In PHP, we can achieve this by using the concatenation operator. The concatenation operator is . . The correct syntax to use this operator is as follows.

The details of these variables are as follows.

The program below shows how we can use the concatenation operator to combine two strings.

Likewise, we can use this operator to combine multiple strings.

In PHP, we can also use the concatenation assignment operator to concatenate strings. The concatenation assignment operator is .= . The difference between .= and . is that the concatenation assignment operator .= appends the string on the right side. The correct syntax to use this operator is as follows.

The program below shows how we can use the concatenation assignment operator to combine two strings.

In PHP, we can also use the sprintf() function to concatenate strings. This function gives several formatting patterns to format strings. We can use this formatting to combine two strings. The correct syntax to use this function is as follows.

The function sprintf() accepts N+1 parameters. The detail of its parameters is as follows.

The function returns the formatted string. We will use the format %s %s to combine two strings. The program that combines two strings is as follows:

Related Article - PHP String

  • How to Remove All Spaces Out of a String in PHP
  • How to Convert DateTime to String in PHP
  • How to Convert String to Date and Date-Time in PHP
  • How to Convert an Integer Into a String in PHP
  • How to Convert an Array to a String in PHP
  • How to Convert a String to a Number in PHP

Home » PHP Tutorial » PHP Assignment Operators

PHP Assignment Operators

Summary : in this tutorial, you will learn about the most commonly used PHP assignment operators.

Introduction to the PHP assignment operator

PHP uses the = to represent the assignment operator. The following shows the syntax of the assignment operator:

On the left side of the assignment operator ( = ) is a variable to which you want to assign a value. And on the right side of the assignment operator ( = ) is a value or an expression.

When evaluating the assignment operator ( = ), PHP evaluates the expression on the right side first and assigns the result to the variable on the left side. For example:

In this example, we assigned 10 to $x, 20 to $y, and the sum of $x and $y to $total.

The assignment expression returns a value assigned, which is the result of the expression in this case:

It means that you can use multiple assignment operators in a single statement like this:

In this case, PHP evaluates the right-most expression first:

The variable $y is 20 .

The assignment expression $y = 20 returns 20 so PHP assigns 20 to $x . After the assignments, both $x and $y equal 20.

Arithmetic assignment operators

Sometimes, you want to increase a variable by a specific value. For example:

How it works.

  • First, $counter is set to 1 .
  • Then, increase the $counter by 1 and assign the result to the $counter .

After the assignments, the value of $counter is 2 .

PHP provides the arithmetic assignment operator += that can do the same but with a shorter code. For example:

The expression $counter += 1 is equivalent to the expression $counter = $counter + 1 .

Besides the += operator, PHP provides other arithmetic assignment operators. The following table illustrates all the arithmetic assignment operators:

Concatenation assignment operator

PHP uses the concatenation operator (.) to concatenate two strings. For example:

By using the concatenation assignment operator you can concatenate two strings and assigns the result string to a variable. For example:

  • Use PHP assignment operator ( = ) to assign a value to a variable. The assignment expression returns the value assigned.
  • Use arithmetic assignment operators to carry arithmetic operations and assign at the same time.
  • Use concatenation assignment operator ( .= )to concatenate strings and assign the result to a variable in a single statement.

Ace your Coding Interview

  • DSA Problems
  • Binary Tree
  • Binary Search Tree
  • Dynamic Programming
  • Divide and Conquer
  • Linked List
  • Backtracking

Concatenate strings in PHP

This article demonstrates how to concatenate strings in PHP.

1. Using Concatenation Operator

Unlike other programming languages, which use the + operator for concatenating two strings, PHP uses the . concatenation operator for string concatenation. It returns the concatenation of its right and left arguments.

Download    Run Code

  Consider using the concatenating assignment operator ( .= ) to append one string to another. It appends the argument on the right side to the argument on the left side.

2. Using Variable Interpolation

The string concatenation using the . operator in PHP might result in performance overhead from constructing lots of intermediate strings along the way. For concatenating more than two strings, variable interpolation is a better choice. Using the curly braces syntax, you can interpolate a variable in a string literal. When a double-quoted string is processed by PHP, any interpolated variables will be parsed and replaced with their corresponding values.

  It should be noted that the variable interpolation will only work in double-quoted strings. Interpolating a variable into a single-quoted string will result in the literal name of the supplied variable. For example, the following code tries to interpolate variables into a string literal enclosed in single quotes.

  The above syntax encloses the variable name in curly braces for better visibility. However, it is also possible to interpolate variables within a string literal with double quotes without curly braces:

3. Using Heredoc syntax

Another option to concatenate strings in PHP is the Heredoc text. It behaves like a double-quoted string, without the double quotes. It has the syntax: <<< which is followed by an identifier, a newline, and the string itself. Finally, the same identifier is provided to close the quotation.

4. Using sprintf() function

If you want to apply some formatting options to the strings, you can use the sprintf() function for string concatenation. This is likely to run slower than all of the above proposed solutions. The printf() function can also be used if you want to output the result.

5. Using echo with commas

Finally, you can directly pass your strings to the echo statement, separated by commas ( , ). This will result in a minor speed improvement over the string concatenation operator ( . ), but will output the results and not assign them to a variable.

That’s all about concatenating strings in PHP.

Convert an integer or a float to a string in PHP

Rate this post

Average rating 5 /5. Vote count: 1

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Tell us how we can improve this post?

Thanks for reading.

To share your code in the comments, please use our online compiler that supports C, C++, Java, Python, JavaScript, C#, PHP, and many more popular programming languages.

Like us? Refer us to your friends and support our growth. Happy coding :)

concatenating assignment operator

Software Engineer | Content Writer | 12+ years experience

guest

Primary links

  • HTML Color Chart
  • Knowledge Base
  • Devguru Resume
  • Testimonials
  • Privacy Policy

Font-size: A A A

PHP » Operators » .=

Concatenation assignment operator.

Concatenates the left operand and the right operand.

Explanation:

A variable is changed with an assignment operator.

concatenating assignment operator

© Copyright 1999-2018 by Infinite Software Solutions, Inc. All rights reserved.

Trademark Information | Privacy Policy

Event Management Software and Association Management Software

String Operators in PHP : Tutorial

Concatenation operator, concatenation assignment operator (.=).

JS Tutorial

Js versions, js functions, js html dom, js browser bom, js web apis, js vs jquery, js graphics, js examples, js references, javascript operators.

Javascript operators are used to perform different types of mathematical and logical computations.

The Assignment Operator = assigns values

The Addition Operator + adds values

The Multiplication Operator * multiplies values

The Comparison Operator > compares values

JavaScript Assignment

The Assignment Operator ( = ) assigns a value to a variable:

Assignment Examples

Javascript addition.

The Addition Operator ( + ) adds numbers:

JavaScript Multiplication

The Multiplication Operator ( * ) multiplies numbers:

Multiplying

Types of javascript operators.

There are different types of JavaScript operators:

  • Arithmetic Operators
  • Assignment Operators
  • Comparison Operators
  • String Operators
  • Logical Operators
  • Bitwise Operators
  • Ternary Operators
  • Type Operators

JavaScript Arithmetic Operators

Arithmetic Operators are used to perform arithmetic on numbers:

Arithmetic Operators Example

Arithmetic operators are fully described in the JS Arithmetic chapter.

Advertisement

JavaScript Assignment Operators

Assignment operators assign values to JavaScript variables.

The Addition Assignment Operator ( += ) adds a value to a variable.

Assignment operators are fully described in the JS Assignment chapter.

JavaScript Comparison Operators

Comparison operators are fully described in the JS Comparisons chapter.

JavaScript String Comparison

All the comparison operators above can also be used on strings:

Note that strings are compared alphabetically:

JavaScript String Addition

The + can also be used to add (concatenate) strings:

The += assignment operator can also be used to add (concatenate) strings:

The result of text1 will be:

When used on strings, the + operator is called the concatenation operator.

Adding Strings and Numbers

Adding two numbers, will return the sum, but adding a number and a string will return a string:

The result of x , y , and z will be:

If you add a number and a string, the result will be a string!

JavaScript Logical Operators

Logical operators are fully described in the JS Comparisons chapter.

JavaScript Type Operators

Type operators are fully described in the JS Type Conversion chapter.

JavaScript Bitwise Operators

Bit operators work on 32 bits numbers.

The examples above uses 4 bits unsigned examples. But JavaScript uses 32-bit signed numbers. Because of this, in JavaScript, ~ 5 will not return 10. It will return -6. ~00000000000000000000000000000101 will return 11111111111111111111111111111010

Bitwise operators are fully described in the JS Bitwise chapter.

Test Yourself With Exercises

Multiply 10 with 5 , and alert the result.

Start the Exercise

Test Yourself with Exercises!

Exercise 1 »   Exercise 2 »   Exercise 3 »   Exercise 4 »   Exercise 5 »

Get Certified

COLOR PICKER

colorpicker

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: [email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail: [email protected]

Top Tutorials

Top references, top examples, get certified.

Know the Code

Developing & Empowering WordPress Developers

Unlock your potential with a Pro Membership

Here is where you propel your career forward. Come join us today. Learn more.

Login to your account

PHP 101: Concatenating Assignment Operator

Lab: wordpress custom taxonomy basics.

Video Runtime: 02:26

The term “concatenating” means that we are smooshing two strings together by appending the one on the right to the one on the left. The result is a new string value.

For example, let’s say that a variable $post_meta has a value of '[post_categories] [post_tags]' . You want to append another shortcode to the end of it. How do you do that?

There are two different ways to achieve this and make an assignment.

Long Hand Approach

To concatenate an existing variable’s string value to some value you are processing, you have a couple of choices in PHP. You can do it with the long hand approach, like this:

$post_meta = $post_meta . ' [post_terms taxonomy="department"]';

where the shortcode’s string literal is smooshed together to the end of the string value in the variable $post_meta . Then the new string is assigned back to the variable. That’s the long hand version.

Short Hand Approach

PHP provides you with a concatenating assignment operator as a shorthand approach:

$post_meta .= ‘ [post_terms taxonomy=”department”]’;

This code works the same as the full version; however, it’s more condensed. It eliminates the repetitious repeating of the variable. Therefore, this approach is more readable and maintainable.

This approach is very popular and prevalent! Make sure you understand it completely!

What’s the Sequence and Result?

Let’s walk through the processing and look at the result.

Step 1: Concatenate

First the variable’s value and string literal are concatenated to form a new string value of:

'[post_categories] [post_tags] [post_terms taxonomy="department"]';

Step 2: Assignment

The next step is to assign the new string to the variable $post_meta , which means the value it represents is changed to:

$post_meta = '[post_categories] [post_tags] [post_terms taxonomy="department"]';

This Episode

In this episode, let’s talk about the process of concatenating. Then we’ll walk through how each of these approaches works. Finally, we’ll see the results.

Code Challenge

Let’s challenge you. Ready? When this function is called, a string literal of '[post_categories]' is passed to it and assigned to the parameter $html . What is the value returned when the function is done running?

Answer : '[post_categories] [post_terms taxonomy="department"]'

Why? PHP concatenates the incoming value with the string literal and then assigns it back to the variable. Then that variable’s value is returned.

Did you get it right? If yes, way to go!! If no, watch the video and if it still doesn’t make sense, come ask me in the Pro Forums.

Code. Eat. Code. Sleep. Dream about Code. Code.

Total Lab Runtime: 01:30:53

  • 1 Lab Introduction free 08:15
  • 2 Custom Taxonomy - The What, Why, and When free 08:32
  • 3 Registering a Custom Taxonomy pro 09:54
  • 4 Configure the Labels pro 14:51
  • 5 Bind to Post Types pro 11:55
  • 6 Configuring Arguments pro 07:52
  • 7 Render Entry Footer Terms pro 08:40
  • 8 PHP 101: Concatenating Assignment Operator pro 02:26
  • 9 PHP 101: Building Strings pro 08:19
  • 10 Test Entry Footer Terms pro 03:03
  • 11 Flush Rewrite Rules pro 03:56
  • 12 Wrap it Up pro 03:10

Developing Professional WordPress Developers - Know the Code

Know the Code develops and empowers professional WordPress developers, like you. We help you to grow, innovate, and prosper.

  • Mastery Libraries
  • What’s New
  • Help Center
  • Developer Stories
  • My Dashboard
  • WP Developers’ Club

Know the Code flies on WP Engine . Check out the managed hosting solutions from WP Engine.

WordPress® and its related trademarks are registered trademarks of the WordPress Foundation. The Genesis framework and its related trademarks are registered trademarks of StudioPress. This website is not affiliated with or sponsored by Automattic, Inc., the WordPress Foundation, or the WordPress® Open Source Project.

Javatpoint Logo

PHP Tutorial

Control statement, php programs, php functions, php strings, php include, state management, upload download, php oops concepts, related tutorials.

Interview Questions

JavaTpoint

  • Send your Feedback to [email protected]

Help Others, Please Share

facebook

Learn Latest Tutorials

Splunk tutorial

Transact-SQL

Tumblr tutorial

Reinforcement Learning

R Programming tutorial

R Programming

RxJS tutorial

React Native

Python Design Patterns

Python Design Patterns

Python Pillow tutorial

Python Pillow

Python Turtle tutorial

Python Turtle

Keras tutorial

Preparation

Aptitude

Verbal Ability

Interview Questions

Company Questions

Trending Technologies

Artificial Intelligence

Artificial Intelligence

AWS Tutorial

Cloud Computing

Hadoop tutorial

Data Science

Angular 7 Tutorial

Machine Learning

DevOps Tutorial

B.Tech / MCA

DBMS tutorial

Data Structures

DAA tutorial

Operating System

Computer Network tutorial

Computer Network

Compiler Design tutorial

Compiler Design

Computer Organization and Architecture

Computer Organization

Discrete Mathematics Tutorial

Discrete Mathematics

Ethical Hacking

Ethical Hacking

Computer Graphics Tutorial

Computer Graphics

Software Engineering

Software Engineering

html tutorial

Web Technology

Cyber Security tutorial

Cyber Security

Automata Tutorial

C Programming

C++ tutorial

Control System

Data Mining Tutorial

Data Mining

Data Warehouse Tutorial

Data Warehouse

RSS Feed

  • Language Reference

Table of Contents

  • Operator Precedence
  • Increment and Decrement
  • Error Control

An operator is something that takes one or more values (or expressions, in programming jargon) and yields another value (so that the construction itself becomes an expression).

Operators can be grouped according to the number of values they take. Unary operators take only one value, for example ! (the logical not operator ) or ++ (the increment operator ). Binary operators take two values, such as the familiar arithmetical operators + (plus) and - (minus), and the majority of PHP operators fall into this category. Finally, there is a single ternary operator , ? : , which takes three values; this is usually referred to simply as "the ternary operator" (although it could perhaps more properly be called the conditional operator).

A full list of PHP operators follows in the section Operator Precedence . The section also explains operator precedence and associativity, which govern exactly how expressions containing several different operators are evaluated.

Improve This Page

User contributed notes 4 notes.

To Top

concatenating assignment operator

Announcing UNISTR and || operator in Azure SQL Database – preview

concatenating assignment operator

Abhiman Tiwari

June 4th, 2024 0 0

We are excited to announce that the UNISTR intrinsic function and ANSI SQL concatenation ope ra tor ( || ) are now available in public preview in Azure SQL Database. The UNISTR function allows you to escape Unicode characters, making it easier to work with international text. The ANSI SQL concatenation ope ra tor ( || ) provides a simple and intuitive way to combine characters or binary strings. These new features will enhance your ability to manipulate and work with text data.  

What is UNISTR function?

The UNISTR function takes a text literal or an expression of characters and Unicode values, that resolves to character data and returns it as a UTF-8 or UTF-16 encoded string . This function allows you to use Unicode codepoint escape sequences with other characters in the string. The escape sequence for a Unicode character can be specified in the form of \ xxxx or \+ xxxxxx , where xxxx is a valid UTF-16 codepoint value, and xxxxxx is a valid Unicode codepoint value. This is especially useful for inserting data into NCHAR columns.  

The syntax of the UNISTR function is as follows:

  • The data type of character_expression could be char ,  nchar ,  varchar , or  nvarchar . For  char and  varchar  data types, the collation should be a valid UTF-8 collation only.
  • A single character representing a user-defined Unicode escape sequence. If not supplied, the default value is \.

Example #1:

For example, the following query returns the Unicode character for the specified value:

——————————-

Example #2:  

In this example, the UNISTR function is used with a user-defined escape character ( $ ) and a VARCHAR data type with UTF-8 collation.

I ♥ Azure SQL.

The legacy collations with code page can be identified using the query below:

What is ANSI SQL concatenation operator (||)?

The ANSI SQL concatenation ope ra tor ( || ) concatenates two or more characters or binary strings, columns, or a combination of strings and column names into one expression . The || ope ra tor does not honor the SET CONCAT_NULL_YIELDS_NULL option and always behaves as if the ANSI SQL behavior is enabled . This ope ra tor will work with character strings or binary data of any supported SQL Server collation . The || ope ra tor supports compound assignment || = similar to += . If the ope ra nds are of incompatible collation, then an error will be thrown. The collation behavior is identical to the CONCAT function  of character string data.

The syntax of the string concatenation operator is as follows:

  • The expression is a character or binary expression. Both expressions must be of the same data type, or one expression must be able to be implicitly converted to the data type of the other expression. If one ope ra nd is of binary type, then an unsupported ope ra nd type error will be thrown.

Example #1:  

For example, the following query concatenates two strings and returns the result:

Hello World!

Example #2:

In this example, multiple character strings are concatenated. If at least one input is a character string, non-character strings will be implicitly converted to character strings.

full_name order_details                                                                                                         item_desc

Josè Doe Order-1001~TS~Jun 1 2024 6:25AM~442A4706-0002-48EC-84FC-8AF27XXXX NULL

Example #3:  

In the example below, concatenating two or more binary strings and also compounding with T-SQL assignment operator.

V1          B1    B2

0x1A2B       0x4E  0xAE8C602E951AC245ADE767A23C834704A5

Example #4:  

As shown in the example below, using the || operator with only non-character types or combining binary data with other types is not supported.

Above queries will fail with error messages as below –  

In this blog post, we have introduced the UNISTR function and ANSI SQL concatenation operator (||) in Azure SQL Database.  The UNISTR function allows you to escape Unicode characters, making it easier to work with international text. ANSI SQL concatenation operator (||) provides a simple and intuitive way to combine characters or binary data. These new features will enhance your ability to manipulate and work with text data efficiently.  

We hope you will explore these enhancements, apply them in your projects, and share your feedback with us to help us continue improving.   Thank you!

concatenating assignment operator

Abhiman Tiwari Senior Product Manager, Azure SQL

authors

Leave a comment Cancel reply

Log in to start the discussion.

light-theme-icon

Insert/edit link

Enter the destination URL

Or link to existing content

  • Skip to main content
  • Skip to search
  • Skip to select language
  • Sign up for free
  • Português (do Brasil)

JavaScript reference

The JavaScript reference serves as a repository of facts about the JavaScript language. The entire language is described here in detail. As you write JavaScript code, you'll refer to these pages often (thus the title "JavaScript reference").

The JavaScript language is intended to be used within some larger environment, be it a browser, server-side scripts, or similar. For the most part, this reference attempts to be environment-agnostic and does not target a web browser environment.

If you are new to JavaScript, start with the guide . Once you have a firm grasp of the fundamentals, you can use the reference to get more details on individual objects and language constructs.

JavaScript standard built-in objects , along with their methods and properties.

Value properties

Function properties.

  • parseFloat()
  • decodeURI()
  • decodeURIComponent()
  • encodeURI()
  • encodeURIComponent()
  • escape() Deprecated
  • unescape() Deprecated

Fundamental objects

Error objects.

  • AggregateError
  • ReferenceError
  • SyntaxError
  • InternalError Non-standard

Numbers and dates

Text processing, indexed collections.

  • Uint8ClampedArray
  • Uint16Array
  • Uint32Array
  • BigInt64Array
  • BigUint64Array
  • Float16Array
  • Float32Array
  • Float64Array

Keyed collections

Structured data.

  • ArrayBuffer
  • SharedArrayBuffer

Managing memory

  • FinalizationRegistry

Control abstraction objects

  • AsyncIterator
  • GeneratorFunction
  • AsyncGeneratorFunction
  • AsyncGenerator
  • AsyncFunction

Internationalization

  • Intl.Collator
  • Intl.DateTimeFormat
  • Intl.DisplayNames
  • Intl.DurationFormat
  • Intl.ListFormat
  • Intl.Locale
  • Intl.NumberFormat
  • Intl.PluralRules
  • Intl.RelativeTimeFormat
  • Intl.Segmenter

JavaScript statements and declarations

Control flow

  • try...catch

Declaring variables

Functions and classes.

  • async function
  • async function*
  • for await...of
  • Expression statement
  • with Deprecated

Expressions and operators

JavaScript expressions and operators .

Primary expressions

Left-hand-side expressions.

  • Property accessors
  • import.meta

Increment and decrement

Unary operators, arithmetic operators, relational operators.

  • < (Less than)
  • > (Greater than)

Equality operators

Bitwise shift operators.

  • >>>

Binary bitwise operators

Binary logical operators, conditional (ternary) operator.

  • (condition ? ifTrue : ifFalse)

Assignment operators

  • >>>=
  • &&=
  • [a, b] = arr , { a, b } = obj

Yield operators

Spread syntax, comma operator.

JavaScript functions.

  • Arrow Functions
  • Default parameters
  • Rest parameters
  • Method definitions

JavaScript classes.

  • constructor
  • Private properties
  • Public class fields
  • Static initialization blocks

Additional reference pages

  • Lexical grammar
  • Data types and data structures
  • Iteration protocols
  • Trailing commas
  • Strict mode
  • Deprecated features

concatenating assignment operator

IMAGES

  1. php101-concatenating-assignment-operator

    concatenating assignment operator

  2. PPT

    concatenating assignment operator

  3. 10th Computer Science||What Is Concatenation,assignment Operator and

    concatenating assignment operator

  4. [100% Working Code]

    concatenating assignment operator

  5. Assignment Operator in C

    concatenating assignment operator

  6. Assignment Operators in Java with Examples

    concatenating assignment operator

VIDEO

  1. String Concatenation

  2. 03

  3. Concatenating Strings with space between

  4. How to Concatenate Cells and Add Different Separators in Excel

  5. #20. Assignment Operators in Java

  6. 2.5.2 Concatenating Strings

COMMENTS

  1. PHP: String

    There are two string operators. The first is the concatenation operator ('.'), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator (' .= '), which appends the argument on the right side to the argument on the left side. Please read Assignment Operators for more information.

  2. PHP Concatenation Operators

    PHP Compensation Operator is used to combine character strings. Operator. Description. . The PHP concatenation operator (.) is used to combine two string values to create one string. .=. Concatenation assignment.

  3. Addition assignment (+=)

    The addition assignment (+=) operator performs addition (which is either numeric addition or string concatenation) on the two operands and assigns the result to the left operand. Try it. Syntax. js. x += y Description. x += y is equivalent to x = x + y, except that the expression x is only evaluated once.

  4. Concatenation of two strings in PHP

    There are two string operators. The first is the concatenation operator ('. '), which returns the concatenation of its right and left arguments. The second is the concatenating assignment operator (' .= '), which appends the argument on the right side to the argument on the left side. Examples : string2 : World! Output : HelloWorld!

  5. Concatenating Strings in PHP: Tips and Examples

    The primary concatenation operator (.) allows for the seamless combination of strings, while the concatenation assignment operator (.=) provides a convenient means of appending content to existing strings. This versatility is demonstrated through various examples, including simple concatenation operations, the use of concatenation assignment ...

  6. Can I initialize a PHP variable with a concat assignment operator?

    Using concatenating assignment operator for 2 variables same time. 3. php merging or concatenation strings when assigning a variable. 0. PHP Concatenation assignment. 1. access php variable through concatenation. 2. is it necessary to define a variable before using Concatenation assignment operator in php?

  7. How to Concatenate Strings in PHP

    Use the Concatenation Assignment Operator to Concatenate Strings in PHP. In PHP, we can also use the concatenation assignment operator to concatenate strings. The concatenation assignment operator is .=. The difference between .= and . is that the concatenation assignment operator .= appends the string on the right side. The correct syntax to ...

  8. PHP Assignment Operators

    Use PHP assignment operator ( =) to assign a value to a variable. The assignment expression returns the value assigned. Use arithmetic assignment operators to carry arithmetic operations and assign at the same time. Use concatenation assignment operator ( .= )to concatenate strings and assign the result to a variable in a single statement.

  9. Concatenate strings in PHP

    This article demonstrates how to concatenate strings in PHP. 1. Using Concatenation Operator. Unlike other programming languages, which use the + operator for concatenating two strings, PHP uses the . concatenation operator for string concatenation. It returns the concatenation of its right and left arguments. 1.

  10. PHP >> Operators >> .=

    PHP » Operators » .= Syntax: $var .= expressionvarA variable.expressionA value to concatenate the variable with.Concatenation assignment operator.

  11. The Concatenating Assignment Operator, Codecademy's Learn PHP, Concat

    In this PHP programming guide, we take a look at The Concatenating Assignment Operator, Codecademy's Learn PHP, Concat Assignment Operator in PHP. In this l...

  12. How do I concatenate strings in PHP?

    The assignment operator (' .= ') adds the argument on the right side to the argument on the left side. This is a shorter way to concatenate the arguments and assign the result to the same variable. In this PHP String Concatenation example, we use the concatenation operator (' . ') and return the concatenating arguments. Click Execute to run the ...

  13. PHP String Operators(Concatenation) Tutorial : Code2care

    There are two String operators in PHP. 1. Concatenation Operator "." (dot) 2. Concatenation Assignment Operator ".=" (dot equals) Concatenation Operator Concatenation is the operation of joining two character strings/variables together. In PHP we use . (dot) to join two strings or variables. Below are some examples of string concatenation:

  14. JavaScript Operators

    The += assignment operator can also be used to add (concatenate) strings: Example. let text1 = "What a very "; ... Try it Yourself » Note. When used on strings, the + operator is called the concatenation operator. Adding Strings and Numbers. Adding two numbers, will return the sum, but adding a number and a string will return a string: Example ...

  15. PHP 101: Concatenating Assignment Operator

    PHP 101: Concatenating Assignment Operator Lab: WordPress Custom Taxonomy Basics. Video Runtime: 02:26. Skip to episode playlist. The term "concatenating" means that we are smooshing two strings together by appending the one on the right to the one on the left. The result is a new string value.

  16. PHP string Concatenation

    Concatenating Assignment operator (".="): This operation appends the argument on the right side to the argument on the left side. Let's take the various examples of how to use the Concatenation Assignment Operator (".=") to concatenate the strings in PHP. Example 1:

  17. PHP: String operator

    String Operators. There are two string operators : concatenation operator ('.') and concatenating assignment operator ('.='). Example : PHP string concatenation operator

  18. PHP: Operators

    An operator is something that takes one or more values (or expressions, in programming jargon) and yields another value (so that the construction itself becomes an expression). Operators can be grouped according to the number of values they take. Unary operators take only one value, for example ! (the logical not operator) or ++ (the increment ...

  19. Concatenation-assignment in PHP

    3. Because numbers with leading zeroes are treated as octals. if the concatenation would've included the leading zeroes, then 006 would've been interpretted as a string, which makes no sense, because it hasn't got quotes around it. If you want 006 to be treated as a string, write it as one: '006'. Leave it as is, and it'll be interpreted as an ...

  20. Announcing UNISTR and || operator in Azure SQL Database

    We are excited to announce that the UNISTR intrinsic function and ANSI SQL concatenation operator (||) are now available in public preview in Azure SQL Database. The UNISTR function allows you to escape Unicode characters, making it easier to work with international text. The ANSI SQL concatenation operator (||) provides a simple and intuitive ...

  21. JavaScript reference

    JavaScript reference. The JavaScript reference serves as a repository of facts about the JavaScript language. The entire language is described here in detail. As you write JavaScript code, you'll refer to these pages often (thus the title "JavaScript reference"). The JavaScript language is intended to be used within some larger environment, be ...

  22. string concatenation

    string-concatenation; assignment-operator; Share. Improve this question. Follow asked Sep 1, 2016 at 21:35. Pete Pete. 167 1 1 silver badge 10 10 bronze badges. 7. They are exactly the same. - Blackhole. Sep 1, 2016 at 21:37. foo += bar is just syntactic sugar forfoo = foo + bar

  23. UNISTR and ANSI SQL concatenation operator (||)

    The ANSI SQL concatenation operator (||) concatenates two or more characters or binary strings, columns, or a combination of strings and column names into one expression. The || operator does not honor the SET CONCAT_NULL_YIELDS_NULL option and always behaves as if the ANSI SQL behavior is enabled. This operator will work with character strings ...

  24. Assignment operator concatenating instead of copying

    Assignment operator concatenating instead of copying. Ask Question Asked 10 years, 11 months ago. Modified 10 years, 11 months ago. Viewed 184 times 1 I'm having a hard time figuring out my assignment operator in a specific case. I have two arrays of objects, one in the other.