I currently trying to do a str_replace in PHP which is new to me. Here is my current code.
$postAddress = str_replace(\"/current-url/\", \"/path/to/my-news/post/
have a look at PHP String Operators.
$postAddress = str_replace("/current-url/", "/path/to/" . $cat->getTitle() . "/post/", $postAddress);
I think You have to do this:
$postAddress = str_replace("/current-url/", "/path/to/".$cat->getTitle()."/post/", $postAddress);
$postAddress = str_replace("/current-url/", "/path/to/" . $cat->getTitle() . "/post/", $postAddress);
Is that what you want? Use . for concatenation and don't echo the variable.