At 11:15 AM 12/8/02 +1100, Justin French wrote:
I *think* either:

<?
$str = "im the one trying to do this";
echo $str[0];
?>

OR

<?
$str = "im the one trying to do this";
echo $str{0};
?>

Works -- you'll have to experiment, but I believe the second way is correct,
and will echo the first (0th) character in the string.
This depends on PHP version. In the bad old days you had to use $str[0]. Sometime since PHP4 came out they added the preferred $str{0} option, which is the only one that should be used in new code. Extracting characters from a string with [] is depreciated, and may stop working someday.

Rick


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to