Category «PHP»

PHP Arrays

PHP arrays

An array is a collection of related values (a list of items) such as names of cities Creating an array To create an array use the function array() like: Numeric Arrays Numeric Arrays are arrays that use only numeric keys, called as numeric, indexed or ordered arrays. Associative Arrays Associative arrays are arrays that use …

PHP Conditional Statements: if else, switch

PHP arrays

If statement Execute the code if the condition is true If…else statement Switch statement Execute different code depending on a condition. The switch statement is similar to a series of IF statements If the value pass to the switch statement matches, the code that follows the case is executed. Example: Be careful! if we forget …

Difference between single-quoted and double-quoted

PHP arrays

The most important difference between single and double quote, is that anything enclosed in single quotes is treated as literal text. Single quotes When using single quotes we must take care with apostrophes. To use the apostrophe in single quotes, we have to put backslash before apostrophe (which is named as escape character). The backslash …

How to create variables in PHP?

PHP arrays

Creating PHP variables A variable is a container for storing data. In PHP, a variable must begin with the $ sign, followed by the name of the variable When creating variables in PHP, you need to follow some basic rules. Variable names can have any combination of letters, numbers and the underscore; A variable name …

Change PHP configuration without editing php.ini

change PHP configuration settings

This option can ve used if Your hosting company(especially shared hosting) doesn’t give you control of php.ini file. This list includes the php.ini directives you can set to configure your PHP setup. 1. Use .htaccess file This work only on Apache server! For example if we want to change default values php.ini values You must …

How to install PHP on Your own PC?

change PHP configuration settings

How to install PHP on Your own PC To run PHP on Your own PC You have to: a) install a web server install PHP install a database, such as MySQL or b) install XAMPP on Your PC XAMPP is a completely free, open source package, used to install easily Apache distribution on Your PC …

About PHP, syntax, comments and code

change PHP configuration settings

What is PHP? PHP (acronym for Hypertext Preprocessor) is the most popular server-side, open source scripting language, used to build dynamic website. PHP scripts are executed on the server. PHP runs on various platforms (Windows, Linux, Unix, Mac) and is compatible with almost all servers available today (Apache, IIS, …)   What is a PHP …