Bifalgorithm post · Computer science one · String Concatenation

How can strings be concatenated in PHP?

How can strings be concatenated in PHP? (Computer science one · String Concatenation) — "Strings in PHP can be concatenated (combined) in several different way…

Ideas in this flowchart

  • Las cadenas en PHP se pueden concatenar de varias maneras.
  • Uso del operador de concatenación
  • El operador de concatenación en PHP es un punto único (.).
  • $s = "Hello"; $t = "World!"; $msg = $s . " " . $t;
  • El resultado de $msg es "Hello World!".
  • Inserción directa de variables dentro de una cadena
  • Las variables dentro de la cadena se reemplazan por sus valores.
  • $x = 13; $name = "Starlin"; $msg = "Hello, $name, your number is $x";
  • El resultado de $msg es "Hello, Starlin, your number is 13".
Feed/

How can strings be concatenated in PHP?

No cover

Channel

Computer science one

1 page

"Strings in PHP can be concatenated (combined) in several different ways. One way you can combine strings is by using the concatenation operator. In PHP the string concatenation operator is a single period.\n\n1 $s = \"Hello\";\n\n2 $t = \"World!\";\n\n3 $msg = $s . \" \" . $t; //msg contains \"Hello World!\"\n\nAnother way you can combine strings is by placing variables directly inside a string. The variables inside the string are replaced with the variable’s values.\n\nExample:\n\n1 $x = 13;\n\n2 $name = \"Starlin\";\n\n3 $msg = \"Hello, $name, your number is $x\";\n\n4 //msg contains the string \"Hello, Starlin, your number is 13\""

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.