|
Posted by Stefan Rybacki on 08/13/05 12:55
Janwillem Borleffs wrote:
> spaceman33 wrote:
>
>>I am looking for a PHP equivalent of the common Mid$ command, found
>>in VB etc.
>>
>>eg, I have $page containing a lot of text, $a will be the for next
>>variable, so I am looking for something like:
>>
>>for a=1 to len($page)
>>if mid$(page,a,4)<>"User" then goto 444
>>do some stuff
>>444
>>next a
>>
>
>
> Have a look at the substr function (http://www.php.net/substr), e.g.:
>
> for ($i = 0; $i < strlen($page); $i++) {
> if (substr($page, $i, 4) == 'User') {
> // do stuff
> }
> }
>
Why not using strpos? ;)
Regards
Stefan
>
> JW
>
>
>
>
Navigation:
[Reply to this message]
|