<?php $text = 'this is a test sentence'; $max = 12; var_export( preg_replace( "/.{0,$max}\K .*/", '', $text ) );
You have javascript disabled. You will not be able to edit any code.