Data Types in PHP
The values assigned to a PHP variable may be of different data types including simple string and numeric types to more complex data types like arrays and objects.
PHP supports total eight primitive data types: Integer, Floating point number or Float, String, Booleans, Array, Object, resource and NULL. These data types are used to construct variables. Now let's discuss each one of them in detail.
This types are categorised in Scaler(Ineteger, Float, Boolean and String) , Compound (Array, Object) and specials (Null, Resource) as a brief.
Integers are whole numbers, without a decimal point (..., -2, -1, 0, 1, 2, ...). Integers can be specified in decimal (base 10), hexadecimal (base 16 - prefixed with
0x) or octal (base 8 - prefixed with
0) notation, optionally preceded by a sign (
This chapter will give you an idea of very basic syntax of PHP and very important to make your PHP foundation strong.
Before we talk about PHP's syntax, let us first define what syntax is referring to.
Syntax - The rules that must be followed to write properly structured code.
PHP's syntax and semantics are similar to most other programming languages (C, Java, Perl) with the addition that all PHP code is contained with a tag, of sorts. All PHP code must be contained within the following
How PHP code is parsed?
The PHP parsing engine needs a way to differentiate PHP code from other elements in the page. The mechanism for doing so is known as 'escaping to PHP.' When PHP parses a file, it looks for opening and closing tags, which tell PHP to start and stop interpreting the code between them. Parsing in this manner allows PHP to be embedded in all sorts of diff Read more
PHP.INI file Configuration
The PHP configuration file, php.ini, is the final and most immediate way to affect PHP's functionality. The php.ini file is read each time PHP is initialized.in other words, whenever httpd is restarted for the module version or with each script execution for the CGI version. If your change isn.t showing up, remember to stop and restart httpd. If it still isn.t showing up, use phpinfo() to check the path to php.ini.
The configuration file is well commented and thorough. Keys are case sensitive, keyword values are not; whitespace, and lines beginning with semicolons are ignored. Booleans can be represented by 1/0, Yes/No, On/Off, or True/False. The default values in php.ini-dist will result in a reasonable PHP installation that can be tweaked later.
Here we are explaining the important settings in php.ini which you may need for your PHP Parser.
short_open_tag = Off
Short open tags look like this: <? ?>. This Read more
The PHP Installer
Although an installer is available from php.net, I would recommend the manual installation if you already have a web server configured and running.
Manual installation offers several benefits:
- Backing up, reinstalling, or moving the web server can be achieved in seconds
- You have more control over PHP and Apache configuration.
Next we will be installing PHP version 5. Follow the steps carefully.
- Go tophp.net and download the "PHP 5.2.0 zip package" to your desktop. (Be patient while it downloads, the ZIP file is over 9MB!)
Note: Make sure that you download the PHP 5.2.0 zip package!
- Create a new folder called "php" in your C Drive. Copy the "php-5.2.0-Win32.zip" file to there ("C:\php") and extract i Read more
The PHP Hypertext Preprocessor (PHP) is a programming language that allows web developers to create dynamic content that interacts with databases.
PHP is basically used for developing web based software applications.
PHP started out as a small open source project that evolved as more and more people found out how useful it was. Rasmus Lerdorf unleashed the first version of PHP way back in 1994.
- PHP is a recursive acronym for "PHP: Hypertext Preprocessor".
- PHP is a server side scripting language that is embedded in HTML. It is used to manage dynamic content, databases, session tracking, even build entire e-commerce sites.
- It is integrated with a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
- PHP is pleasingly zippy in its execution, especially when compiled as an Apache module on the Unix side. The MySQL server, once started, executes even very complex que Read more