How To Assigning a New Character in a String using PHP?
Submitted by: AdministratorThe 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 ";
$string{11} = '!';
echo "$string ";
?>
This script will print:
It's Friday?
It's Friday!
Submitted by: Administrator
<?php
$string = 'It's Friday?';
echo "$string ";
$string{11} = '!';
echo "$string ";
?>
This script will print:
It's Friday?
It's Friday!
Submitted by: Administrator
Read Online PHP Job Interview Questions And Answers
Top PHP Questions
☺ | What is the difference between PHP4 and PHP5? |
☺ | What is the difference between characters \023 and \x23? |
☺ | How To Download and Install PHP on Windows? |
☺ | What are the difference between abstract class and interface? |
☺ | How many ways we can pass the variable through the navigation between the pages? |
Top Coding/Programming Categories
☺ | Python Interview Questions. |
☺ | OOP Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |