The community is working on translating this tutorial into Turkish, but it seems that no one has started the translation process for this article yet. If you can help us, then please click "More info".
If you are fluent in Turkish, then please help us - just point to any untranslated element (highlighted with a yellow left border - remember that images should have their titles translated as well!) inside the article and click the translation button to get started. Or have a look at the current translation status for the Turkish language.
If you see a translation that you think looks wrong, then please consult the original article to make sure and then use the vote button to let us know about it.
Please help us by translating the following metadata for the article/chapter, if they are not already translated.
If you are not satisfied with the translation of a specific metadata item, you may vote it down - when it reaches a certain negative threshold, it will be removed. Please only submit an altered translation of a metadata item if you have good reasons to do so!
As mentioned in the previous chapter, PHP is a loosely typed language. You don't have to tell the interpreter which type a certain variable is, you just have to assign a value to it, and PHP will know which type to treat it as. In the perfect world, you would never have to care about the type of a variable, but as we all know, the world is far from perfect. There will be many situations where controlling the type of a variable will make sense, and therefore, PHP does expose functions to detect and manipulate the type of a variable. First, a little bit of information about the various types in PHP.
PHP consists of 4 basic data types:
boolean - a boolean is actually much like an integer, but with only two possible values: 0 or 1, which is either false or true.
integer - a number with no decimals, e.g 3 or 42.
float (sometimes referred to as double) - a number that may include decimals, e.g. 42.3 or 10.9.
string - A number of characters, which combined makes a text string.
Besides that, there are a couple of more complex datatypes:
array - holds an array of items, e.g. several strings or several integers. An array may contain variables which are arrays which are arrays and so on.
object - a reference to an instance of a class. This is related to Object Oriented programming, which we will talk more about later on in this tutorial.
There are also a couple of special types:
resource - holds a reference to a special external resource. It may be a file resource, or perhaps an open database connection.
NULL - a value of null is nothing. It's not the same as 0 (zero), because that's actually a value. Null is truly nothing. Variables which have not yet been assigned a value, or which you have used the unset() method on, will carry the NULL value. This is useful if you wish to check whether or not a variable contains any value - you may compare it against the NULL constant.
In the next couple of chapters, we will look into working with both strings and numbers (integers and floats), and later on, we will look into both arrays and objects.