$newString = substr($originalString, 0, -4);
Here is what the above code is Doing:
1. We’re taking the original string and using the substr() function to get a substring of it.
2. The first argument is the string we want to get a substring of.
3. The second argument is the starting index.
4. The third argument is the length of the substring.
5. We’re using the strlen() function to get the length of the original string.
6. We’re subtracting 4 from the length of the original string to get the length of the substring.
7. We’re storing the substring in a new variable called $newString.