The Zip files functions let you to read ZIP files.
Installation
For the Zip file functions to work on your server, these libraries must be installed:
Installation on Linux Systems
PHP 5+: Zip functions and the Zip
library is not enabled by default and must be downloaded from the links above.
Use the –with-zip=DIR configure option to include Zip support.
Installation on Windows Systems
PHP 5+: Zip functions are not
enabled by default, so the php_zip.dll and the ZZIPlib library must be downloaded from the link above. Php_zip.dll must be enabled inside of php.ini. To enable any PHP extension, the PHP extension_dir setting (in the php.ini file) should be set to the directory where the PHP extensions are located. An example extension_dir value is c:\php\ext.
PHP Zip File Functions
PHP: indicates the earliest version of PHP that supports the function.
| Function | Description | PHPversion |
|---|---|---|
| zip_close() | Closes a ZIP file | 4 |
| zip_entry_close() | Closes an entry in the ZIP file | 4 |
| zip_entry_compressedsize() | Returns the compressed size of an entry in the ZIP file | 4 |
| zip_entry_compressionmethod() | Returns the compression method of an entry in the ZIP file |
4 |
| zip_entry_filesize() | Returns the actual file size of an entry in the ZIP file |
4 |
| zip_entry_name() | Returns the name of an entry in the ZIP file | 4 |
| zip_entry_open() | Opens an entry in the ZIP file for reading | 4 |
| zip_entry_read() | Reads from an open entry in the ZIP file | 4 |
| zip_open() | Opens a ZIP file | 4 |
| zip_read() | Reads the next entry in a ZIP file | 4 |
PHP has been around for a few years now and has developed as a language. Why should you use it over ASP, JSP, or Perl when you are building a web application? With a veritable alphabet of programming languages to choose from when you decide to write a web based application, why should you choose PHP over ASP, JSP, Perl, CGI, or Cold synthesis? While any decision you make also has to be based on the business supplies of the application, as a consultant you often have the choice of what language to use. So barring an IT department that tells you “It’s Microsoft or nothing!” or a gaggle of UNIX developers demanding that all their applications be Java based, here are a few reasons why PHP is the best solution for web applications. It was created for the web – PHP started as a collection of C applications that the author wrote for use on his own web site. It evolved into a server-side scripting language built for building logic into web pages. This firmness in design has resulted in a language that is both flexible and streamlined for use on the web. Its cross-platform – PHP runs on UNIX, Linux, Mac OSX, and Windows. In addition to being cross-platform, it has built in functions for connecting to most popular database, including general ODBC connections. It’s cross-language – What does that mean? It’s a term I coined to show that PHP can use objects in languages other than PHP. It can call Windows COM objects and Java objects, making it easier to separate the business logic from the user interface. The PHP team is even working on letting it call .NET meeting. The syntax is based on C – Being based on C makes it easier for Java, C, even JavaScript programmers to pick up. It also has built in functions for handling regular expressions, XML parsing, and cryptography. You can compile in different libraries that allow you to manipulate graphics. One feature of the language where it breaks from the C syntax is it’s object-oriented nature. It supports the creation of custom classes and allowing other classes to inherit from your custom classes. Future releases should further enhance it’s object-oriented capabilities. PHP is much faster than CGI – It’s not as fast as JSP’s, which are compiled, but it is faster and uses less system resources than CGI programs do. My final reason for choosing PHP over other languages has to do with the popularity of the languages. Thousands of web pages are running PHP and it has a dedicated following. If you choose to learn PHP, you can be assured that you can find enough resources to answer any question you have and in most cases you’ll find that someone has already written code that does exactly what you need and is giving it away for free.
Each of these technologies have their strengths and weakness but overall for beginners getting into the game of dynamic websites There are some reason to choose this language
1. It is so popular that cheap PHP hosting is not hard to find.
2. It is free.
3 It is easy to learn
4. It is flexible and powerful.
5. PHP is probably the most popular web scripting language and environment out today so there is a lot of freely available information out there on it.
In general when a new software version appears everybody hurries to update it particularly if it is for free. PHP 5 has just come into view and it seems that there are people who use the PHP 4 version and others who use the PHP 5 one.
You most likely know that PHP 5 is destined for OOP, but it appears that usual programming can be used too. Furthermore, OOP is used in PHP4 as well, with the difference that in PHP5 things are a little more evaluated. This means that in PHP4 safety modes for classes (public, private) are not accepted. In PHP4 the objects are a kind of structures which accept objects and functions as well, according to OOP. In PHP4 they are useful as well.
If you are used to working with PHP4 you can use PHP5 with no problems because the differences are not important and the changes were made so that programmers would not be confused. An example would be class builders which, in PHP4 were functions within the classes bearing the same name as the class. In PHP5 it is firstly checked if there is a function (method) __construct (). If it does not exist, check if there is a function (method) which has the same name as the class. This means that even if you are not aware of the latest news in the domain of PHP5, your scripts will function without any problem.
If you want to install PHP4 and PHP5 in parallel, you can set USE indicators, which are different for each version and you can find out a lot of other important pieces of information asking us.
PHP 5 has been a very important release for the language – it has formalized a lot of the features that before had only a little support, or was perhaps distracted. It was also the first version after PHP 4, which was a rebellion in the language, so it had a great deal to live up to. As a major version, PHP 5 has a lifespan of between three and four years – PHP 4 was officially released on 22nd May 2000 and went through many revisions before being replaced by PHP 5 over four years later.
Between now and PHP 6, we will observe several minor patch releases at first that correct many problems with the original PHP 5 release. With PHP 5.1, whenever it is released, we will see the first big set of new functionality – mostly new functions to use, and new ways of doing things. What is certain is that more and more extensions will be added to the system to allow programmers to take advantage of more and more things in their code.
Already confirmed for PHP 5.1 is the PHP Data Objects extension (PDO), which unifies the various database APIs so that you can just call pdo_query() rather than mysql_query(), pgsql_query(), or any of the others. It won’t replace PEAR::DB because it doesn’t abstract the SQL dialects being used, but it will instead complement PEAR::DB. We’re also expecting big speed improvements in PHP 5.1, and not just in any single area – all sorts of calls, from switch/case statements to the sort() function and class autoloading are all improved.
When it comes to what will be in PHP 6, who knows? Many people have asked that PHP be able to compile down into native instructions for maximum speed, which would certainly keep PHP in the lead when it comes to performance, however it would particularly hard to execute. Another possibility is that code caching be built directly into the language so that products such as PHP Accelerator and Zed Performance Suite are no longer necessary – the language could be made to accept caching simply by toggling a switch in php.ini. It is also possible that some features left out from PHP 5 will finally see the light of day in PHP 6, such as namespaces – only time will tell.
Having said that, there are two features I’d particularly like to see in future releases: multiple dispatch and junctions. Multiple dispatches are the technique of calling a given function on several objects at the same time, and if it were in PHP would look something like this:
$array = array($object1, $object2);
$array->doFunc($para1, $para2, $para3);
That would call the doFunc() method of $object1 and $object2, passing in $para1, $para2, and $para3. Junctions – also called quantum superposition by some Perl hackers – is a new feature in Perl 6 that allows you to assign more than one value to a variable then run circumstances like “if $myvar is any of values A, B, C, or D, then…”. Yes, this is already possible with lots of || operators (or && operators if you want to say “$myvar is all of these values…”). Mmmm… quantum superposition!
With PHP continuing to gain massive support from programmers looking to expand their programming horizon, new versions of the language are likely to be geared towards solidifying its position as opposed to revolutionize. When Perl 6 was being intended, many huge changes were brought that separated a lot of developers – hopefully PHP will not go the same way.
In the interim, be happy that you have chosen such a popular language that is advancing so rapidly – PHP is here to stay, and things are only going to get better!
PHP isn’t exclusively for Web pages. You can use it like Perl for cron jobs and other tasks.
If PHP is your scripting language of choice when it comes to developing dynamic Web sites, you probably have grown to love its immediacy and power. An estimated ten million Web sites use at least some PHP scripting to generate their pages.
Although most people use PHP primarily as a Web development scripting system, it possesses all the characteristics of a proper general-purpose language that can be useful in a variety of other environments. In this article, I illustrate how it’s possible to use the command-line version of PHP to perform complex shell operations, such as manipulating data files, reading and parsing remote XML documents and scheduling important tasks through cron.
The contents of this article are based on the latest version of PHP at the time of this writing, 4.3.0, which was released at the end of 2002. However, you should be able to use older versions of PHP 4 without many problems. I explain the differences you may encounter as necessary.
With the release of PHP 4.3, a new version of the interpreter called command-line interface (or PHP-CLI) is available. PHP-CLI is not a shell as the name implies but, rather, a version of PHP designed to run from the shell. As far as software development is concerned, only a few differences exist between PHP-CLI and its CGI or server API (SAPI) counterparts. For one thing, traditional Apache server variables are not available, as Apache isn’t even in the picture, and the HTTP headers are not output when a script is executed. Also, the engine does not use output buffering, because it would be of no benefit in a non-Web environment.