|
141 | 141 |
|
142 | 142 | ## Introduction
|
143 | 143 |
|
| 144 | +PHP is a **dynamic language** with **Weak Typing**. That means you don't have to declare the type of a variable ahead of time. The type will get determined automatically while the program is being processed. That also means that variables are not "bound" to a specific data type.: |
| 145 | +```php |
| 146 | +$foo = "x"; // foo contains a string |
| 147 | +$foo = $foo + 2; // foo concatenates with a number |
| 148 | +echo $foo; |
| 149 | +``` |
| 150 | + |
| 151 | +### Data Types in PHP |
| 152 | + |
| 153 | +PHP supports the following data types: |
| 154 | + |
| 155 | +- Four scalar types: |
| 156 | + |
| 157 | + - [boolean](http://php.net/manual/en/language.types.boolean.php) (`True` and `False`) |
| 158 | + - [integer](http://php.net/manual/en/language.types.integer.php) (Positive and negative numbers) |
| 159 | + - [float](http://php.net/manual/en/language.types.float.php) (Floating point numbers) |
| 160 | + - [string](http://php.net/manual/en/language.types.string.php) (series of characters) |
| 161 | + |
| 162 | +- Four compound types: |
| 163 | + - [array](http://php.net/manual/en/language.types.array.php) |
| 164 | + - [object](http://php.net/manual/en/language.types.object.php) |
| 165 | + - [callable](http://php.net/manual/en/language.types.callable.php) |
| 166 | + - iterable |
| 167 | + |
| 168 | +- Two special types |
| 169 | + - [NULL](http://php.net/manual/en/language.types.null.php) |
| 170 | + - [resource](http://php.net/manual/en/language.types.resource.php) |
| 171 | + |
| 172 | + |
| 173 | +#### More details about data types in PHP: |
| 174 | + |
| 175 | +- [Data Types - PHP manual](http://php.net/manual/en/language.types.intro.php) |
| 176 | +- [PHP Data Types - W3Schools](https://www.w3schools.com/php/php_datatypes.asp) |
| 177 | + |
| 178 | +#### Object Oriented Programming in PHP |
| 179 | + |
| 180 | +- [Object oriented PHP - Tutorialspoint](https://www.tutorialspoint.com/php/php_object_oriented.htm) |
| 181 | +- [Object oriented PHP for beginners - Tutsplus](https://code.tutsplus.com/tutorials/object-oriented-php-for-beginners--net-12762) |
144 | 182 |
|
145 | 183 |
|
146 | 184 | ### Big-O Notation and Time Complexity Analysis
|
|
151 | 189 |
|
152 | 190 | ### How to Use
|
153 | 191 |
|
| 192 | +If you have PHP installed in your machine you can easily run a PHP file using: |
| 193 | +``` |
| 194 | +php file_name.php |
| 195 | +``` |
| 196 | +If `php` command not working in your terminal/command line, then you might need to add it to your environment Path. |
| 197 | + |
154 | 198 |
|
155 | 199 | ### Useful Links:
|
156 | 200 | * [Algorithms, 4th Edition (book by: Robert Sedgewick and Kevin Wayne)](http://algs4.cs.princeton.edu/home/)
|
| 201 | +* [PHP the right way](http://www.phptherightway.com/) |
| 202 | +* [Hacking with PHP](http://www.hackingwithphp.com/) |
0 commit comments