Bifalgorithm post · Computer science one · Basics

How can you create and reassign strings in PHP?

How can you create and reassign strings in PHP? (Computer science one · Basics) — "We can create strings by assigning a string literal value to a variable. Str…

Ideas in this flowchart

  • Creating and reassigning strings in PHP
  • A string is created by assigning a string literal to a variable.
  • Strings can be written with single or double quotes.
  • PHP has no individual character type; a single character is a string.
  • The example uses double-quote syntax.
  • $firstName = "Thomas";
  • $lastName = "Waits";
  • A variable containing a string can be reassigned.
  • $firstName = "Tom";
  • Reassignment effectively destroys the old string value.
Feed/

How can you create and reassign strings in PHP?

No cover

Channel

Computer science one

1 page

"We can create strings by assigning a string literal value to a variable. Strings can be specified by either single quotes or double quotes (there are no individual characters in PHP, only single character strings), but we will use the double quote syntax.\n\n1 $firstName = \"Thomas\";\n\n2 $lastName = \"Waits\";\n\n3\n\n4 //we can also reassign values\n\n5 $firstName = \"Tom\"\n\nThe reassignment in the last line in the example effectively destroys the old string."

Flowchart preview
👍
0
0 comments0 shares

Sign in to view and post comments.