Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / PHP

String concatenation (.)

Build an identifier from a prefix and a number.

Version: PHP 8.4; repository runtime, production runtime not attested

Syntax

$value . $operand

Build an identifier from a prefix and a number. Numeric operands become text, so joining digits keeps them in order.

The text of the right operand follows the text of the left operand. An empty string adds no bytes. Supply any separator explicitly.

Evaluation

  • "A" . "07" → "A07"
  • "A" . "" → "A"
  • "3" . "5" → "35"

Examples

<?php
echo json_encode("A" . "07"), PHP_EOL;

echo json_encode("A" . ""), PHP_EOL;

echo json_encode("3" . "5"), PHP_EOL;

Result

"A07"
"A"
"35"

Sources