How do you pull first 100 characters of a string in PHP

I am looking for a way to pull the first 100 characters from a string variable to put in another variable for printing.

Is there a function that can do this easily?

For example:

$string1 = "I am looking for a way to pull the first 100 characters from a string variable to put in another variable for printing.";
$string2 = 100charfunction($string1);
print $string2

To get:

I am looking for a way to pull the first 100 characters from a string vari

Answers


$small = substr($big, 0, 100);

For String Manipulation here is a page with a lot of function that might help you in your future work.


Need Your Help

How to apply templates to controls in Forms?

c# winforms forms controls

I am wondering if there is a way to create templates for controls and apply them to only certain controls. The function below makes predefined setting for controls(GridView and Listbox) and apply i...

Android App crashes on some random devices (TargetInvocationException)

android sharedpreferences targetinvocationexception

My First Android App crashes on some random devices independent from android version or device model when i try to start an intent or clicking a button and setting SharedPreferences**. I really can't