If you want to get a character from a string at a given index using PHP, first thing which come in mind to most javascript or java developers is charAt() function or method, but in PHP there is not such method. Which is a surprise to me, i googled for a while and find out no such methods exist, however we can very easily create one.
so here it is.
so here it is.
public function charAt($string,$index){ return $string{$index}; }That is all folks!
0 comments:
Post a Comment