|
-
Mar 5th, 2005, 06:55 AM
#1
Thread Starter
Addicted Member
Re: a function from VB to PHP
yes
can you do it in PHP?
Last edited by kill_bill_gates; Mar 5th, 2005 at 07:02 AM.
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Mar 5th, 2005, 07:32 AM
#2
Re: a function from VB to PHP
Done:
PHP Code:
function between($start, $end, $string)
{
$pos1 = strpos($string, $start) + strlen($start);
$pos2 = strpos($string, $end) - 1;
return substr($string, $pos1, $pos2 - $pos1 + 1);
}
I'll let you decide its behviour if one or both the search strings are not found.
-
Mar 5th, 2005, 07:40 AM
#3
Thread Starter
Addicted Member
Re: a function from VB to PHP
wow thanks.
I'm kind of a newbie in PHP, can you explain the functions you used?
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
-
Mar 5th, 2005, 07:47 AM
#4
Re: a function from VB to PHP
strpos = (VB) InStr - it returns the index (0 based) of the first occurence of the search string.
substr = (VB) Mid - which returns a portion of a stirng, given a start position and the length all be it more powerful than VB's Mid function. 
The strpos function returns false if it cannot find a string so to set that you would need to use if($pos1 === false).
-
Mar 5th, 2005, 07:44 AM
#5
Re: a function from VB to PHP
Bill Gates killer, that is in PHP... just add the
<?
?>
tags to it...
-
Mar 5th, 2005, 09:26 AM
#6
Thread Starter
Addicted Member
Re: a function from VB to PHP
thanks VisualAd
 Originally Posted by thegreatone
Bill Gates killer, that is in PHP... just add the
<?
?>
tags to it...
what did you mean by that ? I know that's PHP.
"Quis custodiet ipsos custodes?"
Juvenal
Mete the Hun wanted to live in peace with the Chinese. So he gave the Chinese Emperor his favorite horse, best swords in his armory, and lots of other cool stuff. But then the Chinese Emperor asked for one thing. A useless land through the north. It was a small, useless, unproductive, uninhabited piece of land. But Mete the Hun's answer was certain:
I gave you horses, weapons and much more which belonged to me. But the lands are not mine, it's my nation's and I'm ready to fight, kill and die for just an inch my country
-=Joey Jordison R0CKS!! =-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|