Syntax :
string chop (string, charlist);
chop function will remove predefined characters or specified characters in charlist if any from the right end of a string. This function is an alias of- rtrim() function.
string – String to check.
charlist – Optional. This is optional parameter, If any value is provided, then specified characters will be removed from right of a string.
The following characters are removed if the charlist parameter is empty:
This will return the string after removing specified characters in the charlist or predefined characters from right of a string.
$strExample = chop("Hi from tutorialmines.net! ");
echo($strExample);
In above example ,We have string of “Hi from tutorialmines.net! “. So, when we apply chop function. This will remove all ” ” (ordinary white space) from right of a input string.
Now Output will become –
Hi from tutorialmines.net!
If you want to remove string ” chop – PHP String Functions” from the right hand side of a string. See below example for doing it.
$strExample = ("Hi from tutorialmines.net! chop - PHP String Functions");
echo $strExample . "<br>";
echo chop($strExample,"chop - PHP String Functions");
In above example ,We have string of “Hi from tutorialmines.net! chop – PHP String Functions”. So, when we apply chop function. This will remove string “chop – PHP String Functions” from right of a input string.
Output will be like below:
Hi from tutorialmines.net! chop - PHP String Functions
Hi from tutorialmines.net!
App usage is growing steadily without showing any signs of slowing down. Hence, it is no surprise that mobile applications…
As the world has grown more digital, businesses have adapted themselves. An effectual adaptation includes online advertising. Offline advertising styles…
Step into a world where apps dance to the user's tune. Picture Instagram, a photo-sharing sensation that swept the globe.…
COVID-19 has led to a digitalization of lifestyle. As patients are taking their mental and physical health more seriously, healthcare…
Introduction WordPress, an immensely popular content management system (CMS), powers over 40% of the internet. What makes WordPress even more…
For moving companies trying to capture their market share amidst stiff competition, a tip or two about what they can…