Hi folks.
I am currently in the process of learning about MYSQL.
I am working through a chapter in a book I am reading.
While reading this chapter there was a number of things that didn't make much sense to me.
I just have a number of random questions I need help with, below:
1) what is the difference between a 'float', 'double' and a 'decimal (precision scale)' in php? Because I always thought they were the same thing? And the book I am reading just confuses matters. I just need to know (without too much jargon), what the differences are. And what is the difference between 'decimal (precision scale)' and just standard 'decimal'?
2) In the book I am reading it explains 'Date and Time Data Types'. And I really do not understand the meaning behind: TIME.
In the book it explains that its allowed range of values are: – 838:59:59 to 838:59:59
I don't understand what these numbers mean.
3) I just need to ask one question about the 'try block' syntax. In the example below:
try {
$conn = new PDO( $dsn, $username, $password );
$conn- > setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
} catch ( PDOException $e ) {
echo “Connection failed: “ . $e- > getMessage();
}
.. in this snippet of code, i am not 100% sure of the meaning of:
} catch ( PDOException $e ) {
...... to be more specific:
PDOException $e
.... now this is just a guess of mine, but is the:
PDOException
.. in:
PDOException $e
used for 'hinting' the variable '$e'?
4) In the book I am reading it talks about the value NULL.
I always believed that NULL meant the same as false or '0'. But now I don't know what to believe. I was reading a section about MYSQL operators. To be more specific, this:
<=>
... in the book, this operator is described as the "NULL-safe version of equal to".
it also states the following:
< = > is useful if you think either of the values you ’ re
comparing might be NULL. Remember that NULL values propagate throughout an expression, so if any
value in an expression is NULL , the result will also be NULL . This isn ’ t very helpful when you ’ re trying to
compare two values.
... how are NULL values spread across an expression? This sounds very complicated.
... can you also explain the differences between NULL and FALSE?
5) This question is about 'abstract classes'. In the book I am learning php from, they use an abstract class in an application I learned how to build. However, none of the methods in the abstract class were declared abstract. Am I correct in thinking that the only affect this will have is:
- none of the methods inside the abstract class will be abstract?
- and the only affect that will occur will be that you can’t instantiate (create objects from) the abstract class directly.
Paul.