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)
Try this.
<?php
$string = 'Hello<br>';
print($string);
$string = 'Bye<br>';
print($string);
?>
You can test it at http://phpfiddle.org/
string = 'Hello'
print(string)
string = 'Bye'
print(string)
@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
--------
`
Well, the OP tagged the article with PYTHON so I kinda wonder why you posted php code.
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.