In this PHP tutorial, you shall learn how to delete the first character from given string using substr() function, with example programs.

PHP – Delete first character in string

To delete first character from a string in PHP, we can find the substring from index=1 to end of the string. Call substr() function and pass the given string, and an integer value of 1 as arguments.


The syntax to get the string str without its first character using substr() function is

substr($str, 1);

The function returns a string value.



1. Remove first character of a string

In this example, we will take a string str and find an output string which is made from str but without the first character.

PHP Program

  $str = 'apple';
  $output = substr($str, 1);
  echo $output;


PHP - Delete first character of string


In this PHP Tutorial, we learned how to delete the first character of a string, using substr() function.