How you can assign 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:
<?php
$string = 'It's Friday?';
echo "$string ";
$string{11} = '!';
echo "$string ";
?>
This script will print:
It's Friday?
It's Friday!
Submitted by:
Read Online PHP Developer Job Interview Questions And Answers
Top PHP Developer Questions
☺ | Described PHP? |
☺ | What is PEAR in PHP? |
☺ | How you can protect special characters in Query String? |
☺ | Described session in PHP? |
☺ | Described the functionality of the function strstr and stristr? |
Top Computer Programming Categories
☺ | Python Interview Questions. |
☺ | Software engineering Interview Questions. |
☺ | OOP Interview Questions. |
☺ | PHP Interview Questions. |
☺ | VBA (Visual Basic for Applications) Interview Questions. |