Here's what the code does today: 1. Read data from a database 2. Determine the value and process the following business logic based on the result of the decision
Step1: Field read from database: Table $table_name, ID field data type is int
Select Id from $table _name
$id = $value [' id '];
Step2: Judgment Value: if ($id = = = 1) {...}
Since the subsequent logic is not executed, I will print out the $id, the true value is 1
then I do what every programmer will do: Just deny the reality-how can this be wrong ah, this is clearly this ah, this is not possible AH (in which has been bored ~). baffled It, I finally began various doubts, and then saw it: = = =, constant equals, so I was disturbed to try: GetType ($ID), unexpectedly return is: string! So in PHP, the value from the database to make judgments when using = = = to be cautious. and then , the problem is solved.
I asked the great God, the great God said that PHP is a weak type of language, a select returned data, no one rules him what type, alas, wayward ah. The bug took so long to get rid of it.
The above describes what PHP data from the database is the type, including the aspects of the content, I hope the PHP tutorial interested in a friend helpful.