Hello. I am creating crawler but I am stucked at stupid thing. <?php $string = "hello"; PHP: how could I get firs character of string, in this case "h" ? EDIT: I got it, sorry
just a tip: you can also do this $string = "hello"; echo $string[0]; Code (markup): and you might need to check if it's not empty: if(!empty($string)) {...} //or if(isset($string[0])) {...} Code (markup):
I'm just posting to inform you of bad practice. The second and third parameters are int, not string so doing something like substr($string, "0", "1"); is wrong.