Concept

How are PHP strings copied and modified by character?

ComputerScienceOne / Basics

"The assignment operator can also be used to make copies of strings.\n\n1 $firstName = \"Thomas\";\n\n2 $alias = $firstName;\n\nIt is important to understand that this assignment makes a deep copy of the string. Changes to the first do not affect the second one. You can make changes to individual characters in a string by treating it like a zero-indexed array.\n\n1 $a = \"hello\";\n\n2 $a[0] = \"H\";\n\n3 $a[5] = \"!\";\n\n4 //a is now \"Hello!\""

Related Ideas

How are PHP strings copied and modified by character? | ComputerScienceOne | Bifalgorithm | Bifalgorithm