Interviewer And Interviewee Guide

PHP Interview Question:

How To Assigning a New Character in a String using PHP?

Submitted by: Administrator
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 ";
$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
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.