hi,
what is the PHP function to read the specified character -given its position in the string- in a string variable(just like Instr() function in VB)?
thanks in advance
Printable View
hi,
what is the PHP function to read the specified character -given its position in the string- in a string variable(just like Instr() function in VB)?
thanks in advance
[code]
$twister = "peter picked a peck of pickeled peppers";
print(strpos($twister,"peck");
// this will print the position of peck in the string $twister
[code]
HTH
well that's not the one I'm looking for,but that's my fault, I wasn't clear enough. I want the function to read the character at the given position. The character is not known.
e.g
$string="What a beautiful day"
echo functioniwant($string,2)
----------------------------------
The result should be "h".
I think the function you want is substr() :)
Or, you can just do this:
String${Character_Number_Here}
Both will return the character :)
Cheers,
RyanJ
thanks sciguyryan
Quote:
Originally Posted by kill_bill_gates
You are welcome :)
Just remmber if your thread has been solved edit the original post and add [Resolved] to its title and the green checkmark as its icon :)
Cheers,
RyanJ