I was looking at a website that said use of POSIX is dying out in PHP 5.3.
I was also working though a video ISO (from around 2005) that said I should stick to POSIX if I'm new to PHP and have never programmed in Python.
I've read that PCRE is faster than POSIX. I don't what to go hardcore on a regex that's dying out. (I don't have any plans on learning Python for a long while)
POSIX looks quite easy to grasp as I've already been revising it but I don't care for what's easy I want to learn what works better for what I want to do. Which will be string manipulation, verification, & database stuff (once I get to that stage)
what should I learn? please give clear reasons for using either.
Thanks for your time
The PCRE extension is a core PHP extension, so it is always enabled. By default, this extension is compiled using the bundled PCRE library.
The PCRE library is a set of functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5, with just a few differences (see below). The current implementation corresponds to Perl 5.005. +add a note.
Perl has long been considered the benchmark for powerful regular expressions. PHP uses a C library called pcre to provide almost complete support for Perl's arsenal of regular expression features.
Learn PCRE (preg_*
functions in PHP). POSIX regular expressions (ereg*, split
functions in PHP) have been deprecated as of PHP 5.3, and should not be used anymore. This is the official recommendation. To quote the manual page:
This function has been DEPRECATED as of PHP 5.3.0. Relying on this feature is highly discouraged.
POSIX is obsolete and is deprecated.
If by "POSIX" you mean the baseline, older style of regular expressions -- they are dinosaurs. Skip over them and learn Perl Compatible type regular expressions (which also applies to Python, Ruby, PHP, Java, Javascript, etc etc etc)
If by "POSIX" you mean the baseline compatible OS calls that are compatible over many Unixy operating systems -- these are very very important and not obsolete at all.
I think you mean the former. If so SKIP POSIX / BRE regular expressions -- learn Perl type regular expressions.
IF you mean the latter -- learning POSIX OS Concepts is important. (and I am still learning them...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With