I would like to take a string and remove the first 5 characters from the string. I would like to have the remaining portion of the string returned (not the first 5 characters). I want to do the same thing with the end of the string except remove the last 16 characters.
What two functions would I use to do this?
What function(s) do I use?
Moderator: General Moderators
Re: What function(s) do I use?
preg_replace()
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: What function(s) do I use?
Why two functions? Is this a test question or something?
Code: Select all
substr()mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: What function(s) do I use?
I think that is just the way he has phrased it as he asked two questions - not realising that one function is suitable for both problems.AbraCadaver wrote:Why two functions? Is this a test question or something?Code: Select all
substr()
-
dimxasnewfrozen
- Forum Commoner
- Posts: 84
- Joined: Fri Oct 30, 2009 1:21 pm
Re: What function(s) do I use?
Would also work
Code: Select all
explode() - AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: What function(s) do I use?
How so?dimxasnewfrozen wrote:Would also workCode: Select all
explode()
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.