How do I change string values in a variable?

example:
string = 'Hello'
print(string)
change string to 'Bye' <-- How do I do that?
print(string)
Re: Changing a string variable value to another string value 80 80

Try this.

<?php
$string = 'Hello<br>';
print($string);
$string = 'Bye<br>';
print($string);
?>

You can test it at http://phpfiddle.org/

Re: Changing a string variable value to another string value 80 80
string = 'Hello'
print(string)
string = 'Bye'
print(string)
Re: Changing a string variable value to another string value 80 80

@Grib. Are you sure about that? phpfiddle said:

FOUND 3 ERROR(S) AFFECTING 2 LINE(S)
--------------------------------------------------------------------------------
 2 | ERROR | Missing file doc comment
 2 | ERROR | Constants must be uppercase; expected STRING but found string
 4 | ERROR | Constants must be uppercase; expected STRING but found string
--------

`

commented: @grib is right. You can't run python on php fiddle +0
Re: Changing a string variable value to another string value 80 80

Well, the OP tagged the article with PYTHON so I kinda wonder why you posted php code.

commented: Mhissed that. Had PHP on the brain today. +7
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.