<?php $search = 'The'; $replace = 'A'; $subject = "The Quick Brown Fox Jumps Over The Lazy Dog's Thermos!"; echo preg_replace( '/.*\K\b' . preg_quote($search, '/') . '\b/i', $replace, $subject );
You have javascript disabled. You will not be able to edit any code.