The PHP is_null() function is actually an in-built function of the PHP Programming Language which help us to find whether the variable is a NULL value or not. The PHP is_null() function works for PHP 4 and the above PHP versions which are introduced later after PHP 4 version. The type of the $variable_name parameter of the is_null() function is Boolean type value. Is_null() function of PHP accepts only one parameter and that too it is fully mandatory parameter. There are no optional parameters available inside of the is_null() PHP function.
Start Your Free Software Development Course
Web development, programming languages, Software testing & others
Syntax:
is_null( $variable_name )
Explanation of Parameter:
The is_null() function of PHP Programming Language usually accepts only one single parameter as mentioned in the above syntax.
$variable_name:The $variable name helps us to check whether the variable’s value is NULL or not. It is a mandatory parameter. There are no more optional parameters available inside of the is_null() function to mention.
Return value:
The is_null() function will return a Boolean value and the function is going to return TRUE only when the $variable_name is the NULL value, if the variable’s value is not NULL then it will return FALSE statement.
Working of is_null() Function in PHP
- PHP is_null() function woks based on the NULL values present inside of the function’s parenthesis.
- If the variable value inside of the is_null() function then the result will be TRUE and promotes the further conditions statement or any other.
- If the variable’s value inside of the is_null() function is FALSE then statements which are inside of the those conditions will not be executed.
- The value type of the PHP is_null() function is Boolean.
- The only parameter of the is_null() function is a mixed type (mixed type means that it is going to indicate that the parameter has the capability of accepting the multiple types but not necessarily all types).
Examples of PHP is_null()
Given below are the examples mentioned:
Example #1
In the below example, four variables is created with different variables and checked whether they are NULL values or not with the help of is_null() function of the PHP programming language. At first, $var11, $var12, $var13 and $var14 variables are created with different values for them. $var11 and $var13 variables are stored with “NULL” values. $var12 and $var14 values are stored with “\0” and 0 values. \0 is considered as NULL but here it is assigned as a string value. Then “is_null() ? TRUE : FALSE” structured syntax is used to print the TRUE statements/others only if the is_null($variable_name) is TRUE. If not FALSE statement will be printed. Likewise the code implements the results below. Checking the $var11 and $var13 variable’s values using the is_null() function will print the TRUE value whereas for other variables ($var12 and $var14) the result will be FALSE value.
Code:
<?php $var11 = NULL; $var12 = "\0"; $var13 = "NULL"; $var14 = 0; is_null($var11) ?print_r("Null Value So True\n") : print_r("False\n"); is_null($var12) ?print_r("Null Value So True\n") : print_r("Not Null so False\n"); is_null($var13) ?print_r("Null Value So True\n") : print_r("Not Null so False\n"); is_null($var14) ?print_r("Null Value So True\n") : print_r("Not Null so False\n"); ?>
Output:
Example #2
This is the example of demonstrating the working of the is_null() function of the PHP Programming Language. At first, a function “check_null1()” is created with only one parameter “$var11” in it. Inside of the function is_null() function is created to check whether the variable parameter of the function is TRUE or NOT. But here variable value of $var11 is not mentioned. Function is closed and called many times with different inputs. “NULL” is mentioned/passed to the $var11 by changing the capitalization of the NULL words as values. But for the last 3 echo statements, different values passed to the variable parameter of the function. So for the last echo statements the result will be FALSE.
Code:
<?php function check_null1($var11) { return (is_null($var11) ? "Null Value so :: True" : "Not Null Value so :: False"); } echo check_null1(NULL) . "\n"; echo check_null1(null) . "\n"; echo check_null1(Null) . "\n"; echo check_null1(NUll) . "\n"; echo check_null1(NULl) . "\n"; echo check_null1(nulL) . "\n"; echo check_null1(nuLL) . "\n"; echo check_null1(nULL) . "\n"; echo check_null1('Nul') . "\n"; echo check_null1(false) . "\n"; echo check_null1(2). "\n"; ?>
Output:
Example #3
In the below example, $a1, $b1, $c1 and $d1 variables are created. NULL values are passed to $b1 and $d1 variables. Although “null” value is passed to the $c1 variable, but the NULL is passed as a string value. So the result of the $b1 and $d1 variable’s after checking with the is_null() function will be printed as empty value. For $a1 and $c1 variables, result will not all be print.
Code:
<?php echo "For Non-NULL values the value will not be printed . Check Below :: \n"; $a1 = 0; echo "a1 is :: " . is_null($a1) . "\n"; $b1 = null; echo "b1 is :: " . is_null($b1) . "\n"; $c1 = "null"; echo "c1 is :: " . is_null($c1) . "\n"; $d1 = NULL; echo "d1 is :: " . is_null($d1) . "\n"; ?>
Output:
Example #4
This is the example of checking for different $var11 variable’s values whether they are NULL or not. This is done by using different IF and ELSE conditions. At first, $var11 is stored with “TRUE” value and checked with the is_null() function so the ELSE condition result will be printed because the is_null(TRUE) function condition result is FALSE. Likewise for the second IF and ELSE condition, same result is printed. Then for the $var11 variable, “NULL” value is passed and then after checking with the is_null() function the result will show that “Variable var11 is NULL” like that.
Code:
<?php echo "Checking for TRUE value of the var11 variable for NULL :: \n"; $var11 = TRUE; if (is_null($var11)) { echo 'Variable var11 is NULL'; } else { echo 'Variable var11 is not NULL'; } echo "\n"; echo "Checking for FALSE value of the var11 variable for NULL :: \n"; $var11 = FALSE; if (is_null($var11)) { echo 'Variable var11 is NULL'; } else { echo 'Variable var11 is not NULL'; } echo "\n"; echo "Checking for NULL value of the var11 variable for NULL :: \n"; $var11 = NULL; if (is_null($var11)) { echo 'Variable var11 is NULL'; } else { echo 'Variable var11 is not NULL'; } echo "\n"; ?>
Output:
Conclusion
Here we saw introduction of PHP is_null() function with the syntax and it’s parameters explanation, working of PHP is_null() function along with various examples which involves is_null() function to understand the is_null() function well.
以上がPHP is_null()の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

PHPタイプは、コードの品質と読みやすさを向上させるためのプロンプトがあります。 1)スカラータイプのヒント:php7.0であるため、基本データ型は、int、floatなどの関数パラメーターで指定できます。 3)ユニオンタイプのプロンプト:PHP8.0であるため、関数パラメーターまたは戻り値で複数のタイプを指定することができます。 4)Nullable Typeプロンプト:null値を含めることができ、null値を返す可能性のある機能を処理できます。

PHPでは、クローンキーワードを使用してオブジェクトのコピーを作成し、\ _ \ _クローンマジックメソッドを使用してクローン動作をカスタマイズします。 1.クローンキーワードを使用して浅いコピーを作成し、オブジェクトのプロパティをクローン化しますが、オブジェクトのプロパティはクローニングしません。 2。\ _ \ _クローン法は、浅いコピーの問題を避けるために、ネストされたオブジェクトを深くコピーできます。 3.クローニングにおける円形の参照とパフォーマンスの問題を避けるために注意し、クローニング操作を最適化して効率を向上させます。

PHPはWeb開発およびコンテンツ管理システムに適しており、Pythonはデータサイエンス、機械学習、自動化スクリプトに適しています。 1.PHPは、高速でスケーラブルなWebサイトとアプリケーションの構築においてうまく機能し、WordPressなどのCMSで一般的に使用されます。 2。Pythonは、NumpyやTensorflowなどの豊富なライブラリを使用して、データサイエンスと機械学習の分野で驚くほどパフォーマンスを発揮しています。

HTTPキャッシュヘッダーの主要なプレーヤーには、キャッシュコントロール、ETAG、およびラスト修飾が含まれます。 1.Cache-Controlは、キャッシュポリシーを制御するために使用されます。例:キャッシュコントロール:Max-Age = 3600、public。 2。ETAGは、一意の識別子を介してリソースの変更を検証します。例:ETAG: "686897696A7C876B7E"。 3. Last-Modifiedは、リソースの最後の変更時間を示しています。

PHPでは、Password_hashとpassword_verify関数を使用して安全なパスワードハッシュを実装する必要があり、MD5またはSHA1を使用しないでください。 1)password_hashセキュリティを強化するために、塩値を含むハッシュを生成します。 2)password_verifyハッシュ値を比較して、パスワードを確認し、セキュリティを確保します。 3)MD5とSHA1は脆弱であり、塩の値が不足しており、最新のパスワードセキュリティには適していません。

PHPは、動的なWeb開発およびサーバー側のアプリケーションに使用されるサーバー側のスクリプト言語です。 1.PHPは、編集を必要とせず、迅速な発展に適した解釈言語です。 2。PHPコードはHTMLに組み込まれているため、Webページの開発が簡単になりました。 3。PHPプロセスサーバー側のロジック、HTML出力を生成し、ユーザーの相互作用とデータ処理をサポートします。 4。PHPは、データベースと対話し、プロセスフォームの送信、サーバー側のタスクを実行できます。

PHPは過去数十年にわたってネットワークを形成しており、Web開発において重要な役割を果たし続けます。 1)PHPは1994年に発信され、MySQLとのシームレスな統合により、開発者にとって最初の選択肢となっています。 2)コア関数には、動的なコンテンツの生成とデータベースとの統合が含まれ、ウェブサイトをリアルタイムで更新し、パーソナライズされた方法で表示できるようにします。 3)PHPの幅広いアプリケーションとエコシステムは、長期的な影響を促進していますが、バージョンの更新とセキュリティの課題にも直面しています。 4)PHP7のリリースなど、近年のパフォーマンスの改善により、現代の言語と競合できるようになりました。 5)将来的には、PHPはコンテナ化やマイクロサービスなどの新しい課題に対処する必要がありますが、その柔軟性とアクティブなコミュニティにより適応性があります。

PHPの中心的な利点には、学習の容易さ、強力なWeb開発サポート、豊富なライブラリとフレームワーク、高性能とスケーラビリティ、クロスプラットフォームの互換性、費用対効果が含まれます。 1)初心者に適した学習と使用が簡単。 2)Webサーバーとの適切な統合および複数のデータベースをサポートします。 3)Laravelなどの強力なフレームワークを持っています。 4)最適化を通じて高性能を達成できます。 5)複数のオペレーティングシステムをサポートします。 6)開発コストを削減するためのオープンソース。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

AI Hentai Generator
AIヘンタイを無料で生成します。

人気の記事

ホットツール

SecLists
SecLists は、セキュリティ テスターの究極の相棒です。これは、セキュリティ評価中に頻繁に使用されるさまざまな種類のリストを 1 か所にまとめたものです。 SecLists は、セキュリティ テスターが必要とする可能性のあるすべてのリストを便利に提供することで、セキュリティ テストをより効率的かつ生産的にするのに役立ちます。リストの種類には、ユーザー名、パスワード、URL、ファジング ペイロード、機密データ パターン、Web シェルなどが含まれます。テスターはこのリポジトリを新しいテスト マシンにプルするだけで、必要なあらゆる種類のリストにアクセスできるようになります。

WebStorm Mac版
便利なJavaScript開発ツール

mPDF
mPDF は、UTF-8 でエンコードされた HTML から PDF ファイルを生成できる PHP ライブラリです。オリジナルの作者である Ian Back は、Web サイトから「オンザフライ」で PDF ファイルを出力し、さまざまな言語を処理するために mPDF を作成しました。 HTML2FPDF などのオリジナルのスクリプトよりも遅く、Unicode フォントを使用すると生成されるファイルが大きくなりますが、CSS スタイルなどをサポートし、多くの機能強化が施されています。 RTL (アラビア語とヘブライ語) や CJK (中国語、日本語、韓国語) を含むほぼすべての言語をサポートします。ネストされたブロックレベル要素 (P、DIV など) をサポートします。

VSCode Windows 64 ビットのダウンロード
Microsoft によって発売された無料で強力な IDE エディター

DVWA
Damn Vulnerable Web App (DVWA) は、非常に脆弱な PHP/MySQL Web アプリケーションです。その主な目的は、セキュリティ専門家が法的環境でスキルとツールをテストするのに役立ち、Web 開発者が Web アプリケーションを保護するプロセスをより深く理解できるようにし、教師/生徒が教室環境で Web アプリケーションを教え/学習できるようにすることです。安全。 DVWA の目標は、シンプルでわかりやすいインターフェイスを通じて、さまざまな難易度で最も一般的な Web 脆弱性のいくつかを実践することです。このソフトウェアは、
