|
Posted by Jim Michaels on 02/07/06 11:29
"T.Taylor" <taylort2@juno.com> wrote in message
news:1138208606.877180.20140@o13g2000cwo.googlegroups.com...
>I am new to PHP so I thought I would make a Reference List of some of
> the functions.
> Below is what I have so far.
>
>
>
> ASP Functions PHP Functions
> ==================== ===============
> Left(str,length) substr(str,start,length)
> Right(str,length) substr(str,start,length)
> Mid(str,start,stop) substr(str,start,length)
I don't think the statement for Mid() is correct. if it was anything like
Mid$, Mid$ was Mid$(str, start[,length]). Microsoft probably hasn't changed
their string syntax since their first BASIC language came out - BASIC-80 I
think it was.
it seems to me I also Mid(str,start) is probably available as an option.
substr(str,start) is the replacement.
and any time you want to access character #6 of a string in PHP, $string{5}
is how you access it.
You must remember that in PHP, strings are indexed starting from 0. In VB,
they are indexed starting at 1. this is key.
So in ASP, start and stop are 1-based. in PHP, start and stop are 0-based.
> Len(str) strlen(str)
> Trim(str) trim(str)
> LTrim(str) ltrim(str)
> RTrim(str) rtrim(str)
> UCase(str) strtoupper(str)
> LCase(str) strtolower(str)
> InStr(str,value) ---DON'T KNOW---
>
Navigation:
[Reply to this message]
|