<?php $string = "i want to convert this string to the following"; echo preg_replace_callback('/\b\w(?:\w{1,2}\b)?/', fn($m) => strtoupper($m[0]), $string);
You have javascript disabled. You will not be able to edit any code.