1, character comparison:
Comparisons apply to comparing whether a character is case-sensitive:
Program code
$class = ' RFDSAFFSADFSADFASDFSADF ';
$type = ($class [0]< ' a ')? ' Libraries ': ' Helpers ';
Echo$type;
Program code
Echo (' Uppercase A: ');
Echoord (' A ');
Echo (' Echo (' lowercase a: ');
Echoord (' a ');
Output is: Uppercase a:65 lowercase a:97
1, such comparisons should be first converted to ASCII comparison;
2, the first character is Chinese, with $class[0] this way can not be taken out!
3, $class [0] Such a way is not recommended, I have a little forget, should be 4.0 before the writing, should recommend using $class{0}
4, compared with Chinese, you can use Ord (Mb_substr ($class, 0,1, ' utf-8 ')) >127, here is to take the first character and then turn to ASCII, and then compare, greater than 127, may be considered Chinese;
2, First letter capital
Have a relationship with the above, also remember;
Makeastring ' Sfirstcharacteruppercase
Program code
Ucfirst ()
The example in the manual is this:
Program code
<?php
$foo = ' helloworld! ';
$foo =ucfirst ($foo);//helloworld!
$bar = ' helloworld! ';
$bar =ucfirst ($bar);//helloworld!
$bar =ucfirst (Strtolower ($bar));//helloworld!
?>
3, automatic loading
have been curious before, the class file has not require come in, how can directly use it?
The function appears to be supported after a few 5 points;
not supported before;
Spl_autoload_register (Array (' Kohana ', ' auto_load '));
Then the Kohana can be written like this:
Program code
Finalclasskohana
{
Publicstaticfunctionauto_load ($class)
{
Require$class. '. PHP ';
}
}
In this way, you newabc (), as long as the abc.php file exists, will be directly require in;
You should know what it means to have a look.