Tools, FAQ, Tutorials:
Assigning a New Character in a String in PHP
How To Assigning a New Character in a String?
✍: FYIcenter.com
The string element expression, $string{index}, can also be used at the left side of an assignment statement. This allows you to assign a new character to any position in a string. Here is a PHP script example:
<?php
$string = 'It\'s Friday?';
echo "$string\n";
$string{11} = '!';
echo "$string\n";
?>
This script will print:
It's Friday? It's Friday!
⇒ Concatenating Two Strings in PHP
⇐ Accessing a Specific Character in String in PHP
2016-10-13, ∼2705🔥, 0💬
Popular Posts:
How to use the urllib.request.Request object to build more complex HTTP request? The urllib.request....
How To Use an Array as a Queue in PHP? A queue is a simple data structure that manages data elements...
Can You Add Values to an Array without Keys in PHP? Can You Add Values to an Array with a Key? The a...
Can You Add Values to an Array without Keys in PHP? Can You Add Values to an Array with a Key? The a...
How To Read a File in Binary Mode in PHP? If you have a file that stores binary data, like an execut...