Is there a PHP Sandbox, something like JSFiddle is to JS? [closed]

If you are just looking for an online site to play around with PHP code, try http://phpfiddle.org/ http://ideone.com/ https://codeanywhere.net/ http://www.tehplayground.com/ http://sandbox.onlinephpfunctions.com/ http://codepad.org/ https://eval.in/ https://implode.io/ (permits attaching a version of the Laravel framework) The most sophisticated is: http://3v4l.org/ It lets you test your code in all PHP versions starting from PHP4. If you want something for … Read more

Truncate a string to first n characters of a string and add three dots if any characters are removed

//The simple version for 10 Characters from the beginning of the string $string = substr($string,0,10).’…’; Update: Based on suggestion for checking length (and also ensuring similar lengths on trimmed and untrimmed strings): $string = (strlen($string) > 13) ? substr($string,0,10).’…’ : $string; So you will get a string of max 13 characters; either 13 (or less) … Read more