简体   繁体   中英

replacing part of the string using php

I have problem replacing part of the string.

$val='Today';

$string ='TodayRainy';

str_replace($val, '',$string);

length of $val varies.

str_replace() returns the new string. It does not change it in place. This means you have the assign the results to a variable:

$new_string = str_replace($val, '',$string);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM