2022-02-03

Tech Programing

程式人小天地

static string in php?

1 min read


I’ve a problem in understanding statics in string variables in php
i have this code :

$str = "Hello world!";
echo 'before str_replace : '.$str.'</br>';
echo 'str_replace : '.str_replace('world','PHP',$str).'</br>';
echo 'after str_replace : '.$str;

and the result is :

before str_replace : Hello world!
str_replace : Hello PHP!
after str_replace : Hello world!

why there is no change in my string after str_replace?



Source link

資料來源:Stackoverflow

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *