PHP Knowledge Base Update -- August 1st, 1999

From: Date: Mon, 02 Aug 1999 16:23:51 +0000
Subject: PHP Knowledge Base Update -- August 1st, 1999
Groups: php.kb 
Request: Send a blank email to php-kb+get-16@lists.php.net to get a copy of this message
I'm back after two weeks sick in bed with the flu and a week playing catch up for clients. Miss me? <g> Cheers, Nathan ------------------------------------------------------------ What's the easiest way to remove characters from the end of a string? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/514 ------------------------------------------------------------ Matt Allen See the function substr(): http://www.php.net/manual/function.substr.php3 For example: $rest = substr("abcdef", 1, -1); // returns "bcde" so to remove characters from the end of a string you can use: $rest = substr("abcdef", 0, -2); // returns "abcd" ------------------------------------------------------------ What's the fastest way to include a file directly into a page? How can I include the raw content of a file into my HTML output? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/515 ------------------------------------------------------------ Rasmus Lerdorf ReadFile() will be faster since it doesn't have to check for PHP tags like include/require. http://www.php.net/manual/function.readfile.php3 ------------------------------------------------------------ Why are utf8_encode & utf8_decode in the XML module? Why are utf8_encode & utf8_decode NOT in the string module? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/517 ------------------------------------------------------------ Rasmus Lerdorf Because the actual low-level utf8_encode code is part of the expat library that implements xml. As of Apache-1.3.7 these functions are built into Apache and you can compile PHP simply using --with-xml (as of 3.0.12) and you will have access to these functions. Since the functions are already in Apache you are not adding any extra code either since the code is in there whether you use --with-xml or not. ------------------------------------------------------------ Where can I learn more about regular expressions? What are some good books on regular expressions? What type of regular expressions are used in PHP? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/519 ------------------------------------------------------------ Gianluca Baldo, Justin Farnsworth PHP uses the POSIX extended regular expressions as defined by POSIX 1003.2. http://www.php.net/manual/ref.regex.php3 The manual contains some simple examples. If you search the samples archive you'll surelly find more. Take a look at Dario Gomes Column: http://www.phpbuilder.com/columns/dario19990616.php3 is a good starting point. This book is often recommended for learning regular expressions: Mastering Regular Expressions : Powerful Techniques for Perl and Other Tools (Nutshell Handbook) by Jeffrey E. Friedl (Editor), Andy Oram (Editor). http://www.oreilly.com/catalog/regex/

« previous php.kb (#16) next »