Home Backend Development PHP Tutorial 今日犯2了 当永记 PHP TRUE == 2

今日犯2了 当永记 PHP TRUE == 2

Jun 13, 2016 am 11:29 AM
dump str true var

今天犯2了 当永记 PHP TRUE == 2

今天同事测试 投票功能 始终报已投过票的提示,仔细检查了下代码,也没有发现问题出在哪里?

?

最后一行行的排查才发现 原来是 bool == 整数 这个问题

?

$str=" ";

var_dump( empty($str)? );

exit;

?


$str = "1";
var_dump($str[0]);
$str = implode('|',$str);
//var_dump($str);


exit;

$a = 1==1;
$b = 2 == $a;

var_dump($b);
br( "\$b = " . $b );

var_dump(TRUE == 2);


exit;

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

What is a dump file? What is a dump file? Jan 12, 2024 pm 04:58 PM

A dump file usually refers to a binary file, also known as a dump file or core dump file. This kind of file is generated by the computer system when it encounters a serious error or abnormal situation. It is used to store the status, stack, registers, memory images, logs and other information of the system or application.

18 Ways to Fix Audio Service Not Responding Issue on Windows 11 18 Ways to Fix Audio Service Not Responding Issue on Windows 11 Jun 05, 2023 pm 10:23 PM

Audio output and input require specific drivers and services to work as expected on Windows 11. These sometimes end up running into errors in the background, causing audio issues like no audio output, missing audio devices, distorted audio, etc. How to Fix Audio Service Not Responding on Windows 11 We recommend you to start with the fixes mentioned below and work your way through the list until you manage to resolve your issue. The audio service may become unresponsive for a number of reasons on Windows 11. This list will help you verify and fix most issues that prevent audio services from responding on Windows 11. Please follow the relevant sections below to help you through the process. Method 1: Restart the audio service. You may encounter

The role and examples of var keyword in PHP The role and examples of var keyword in PHP Jun 28, 2023 pm 08:58 PM

The role and examples of var keyword in PHP In PHP, the var keyword is used to declare a variable. In previous PHP versions, using the var keyword was the idiomatic way to declare member variables, but its use is no longer recommended. However, in some cases, the var keyword is still used. The var keyword is mainly used to declare a local variable, and the variable will automatically be marked as local scope. This means that the variable is only visible within the current block of code and cannot be accessed in other functions or blocks of code. Use var

Let's talk about the differences between var, let and const (code example) Let's talk about the differences between var, let and const (code example) Jan 06, 2023 pm 04:25 PM

This article brings you relevant knowledge about JavaScript. It mainly introduces the differences between var, let and const, as well as the relationship between ECMAScript and JavaScript. Interested friends can take a look at it. I hope Helpful to everyone.

What is the meaning of dump in computer What is the meaning of dump in computer Jun 10, 2021 am 11:25 AM

In computers, dump means "dump" in Chinese, which generally refers to exporting and dumping data into files or static forms, that is, saving dynamic (volatile) data into static data (persistent data). There is no need to dump data like programs that are originally stored in storage media (such as hard disks).

Python built-in type str source code analysis Python built-in type str source code analysis May 09, 2023 pm 02:16 PM

1The basic unit of Unicode computer storage is the byte, which is composed of 8 bits. Since English only consists of 26 letters plus a number of symbols, English characters can be stored directly in bytes. But other languages ​​(such as Chinese, Japanese, Korean, etc.) have to use multiple bytes for encoding due to the large number of characters. With the spread of computer technology, non-Latin character encoding technology continues to develop, but there are still two major limitations: no multi-language support: the encoding scheme of one language cannot be used in another language and there is no unified standard: for example There are many encoding standards in Chinese such as GBK, GB2312, GB18030, etc. Since the encoding methods are not unified, developers need to convert back and forth between different encodings, and many errors will inevitably occur.

Detailed explanation of the meaning of true in PHP functions Detailed explanation of the meaning of true in PHP functions Mar 16, 2024 am 08:57 AM

Detailed explanation of the meaning of true in PHP function In PHP, true is a Boolean value, representing the state of "true" or "yes". Using true in a function is usually used to express that a condition is true or to return a success status. This article will explain in detail the meaning of true in PHP functions from different perspectives, and give specific code examples. 1. Conditional judgment when true is returned: In PHP functions, true is usually used in conditional judgment to indicate that the condition is true. For example: functioni

Solution to the error AttributeError(\'{0!r} object has no attribute {1!r}\'.format(type(self).__name__, k)) Solution to the error AttributeError(\'{0!r} object has no attribute {1!r}\'.format(type(self).__name__, k)) Feb 29, 2024 pm 06:40 PM

The reason for the error message indicates that in the python code, an object (represented by the self variable) is used, but the object does not have an attribute named k. This may be because the object does not have this property defined, or a type error in the code causes the object to not be of the expected type. How to Fix To resolve this error, you may need to do one or more of the following: Check your code for the error and make sure the object referenced by the self variable has a property named k. Check your code for type errors and make sure the object referenced by the self variable is of the expected type. If the attribute is missing, you need to define this attribute in the class and use tryexcept to get this error. If you are sure that k is an attribute that is not defined in the class, please confirm

See all articles