Q:

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. 

A:

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);

