アプリ関連ニュース

Isset VS Empty In PHP

Today I will walk through the difference between isset & empty , build in functions in PHP.

Iseet

It checks the variable to see if it has been set, in other words, it checks to see if the variable is any value except NULL or not assigned a value. ISSET returns TRUE if the variable exists and has a value other than NULL. That means variables assigned a ” “, 0, “0”, or FALSE are set, and therefore are TRUE for ISSET.

Empty

It checks to see if a variable is empty. Empty is interpreted as: ” ” (an empty string), 0 (0 as an integer), 0.0 (0 as a float), “0” (0 as a string), NULL, FALSE, array() (an empty array), and “$var;” (a variable declared, but without a value in a class.)

Lets do some comparisons.

Non declared variable

isset($novar) – Return FALSE
empty($novar) – Return TRUE

Null Variable

$null = NULL; 
isset ($null) - Return FALSE 
empty ($null) - Return TRUE

Empty String

$emptyString = ""; 
isset($emptyString) - Return TRUE 
empty($emptyString) - Return TRUE 

This will be the same result for zero case.

Boolean value

$tbl = TRUE; 
$fbl = FALSE; 

Isset . Will Return TRUE For Both Cases
Empty

empty($tbl) - Return FALSE 
empty($fbl) - Return TRUE

Empty Array

$arr = [];
The result will be true for both isset and empty

Empty object

$obj = new stdClass (); 
isset ($obj) – return TRUE 
empty ($obj) – return FALSE

Note: Isset only accepts single variable within its parenthesis. Passing others will proceed to error. For example
isset(strtoupper($var)) – this will proceed to error.

By Yuuma



[Laravel] Bladeテンプレートエンジン(2)ディレクティブ編

PHPフレームワーク「Laravel」を使用するにあたり、Viewの作成は、Bladeテンプレートエンジンを使用することが一般的です。
Bladeテンプレートエンジンを使用することでHTMLへのPHPの埋め込みが簡単におこなえるようになります。
今回は、Bladeテンプレートで使用できるディレクティブの紹介をおこないたいと思います。

続きを読む

Android ダイアログを画面いっぱいに表示する

お知らせの通知などのActivityを覆うようなダイアログを表示させたい時に
使える”ほぼ”全画面ダイアログを表示させる方法のご紹介です。

続きを読む

IoT(Internet of things)

I will talk about IoT and how its works today.

IoT , a technology that is automating everyday life and offering simplicity, comfort, and efficiency by making everyday objects digitally represented.

How it works

Sensors / Devices
First, sensors or devices collect data from their environment. This could be as simple as a temperature reading or as complex as a full video.
Multiple sensors can be grouped together or the sensors can be part of a device that does more than just detect things. For example, your phone is a device that has multiple sensors (camera, accelerometer, GPS, etc.), but your phone is not just a sensor.

Connectivity
That data is then sent to the cloud. But you need a way to get there!
Sensors / devices can be connected to the cloud through a variety of methods including: cellular, satellite, WiFi, Bluetooth, Low Power Wide Area Networks (LPWAN), or connected directly to the Internet via Ethernet.
Choosing which connectivity option is best comes down to the specific IoT application, but they all accomplish the same task: bringing data to the cloud.

Data processing
Once the data reaches the cloud, the software does some processing on it.
This could be very simple, such as verifying that the temperature reading is within an acceptable range. Or it could also be very complex, such as using computer video vision to identify objects (such as intruders in your home).

User interface
The information then becomes useful to the end user in some way. This could be through an alert to the user (email, text, notification, etc.). For example, a text alert when the temperature is too high in the company’s cold storage. Also, a user could have an interface that allows them to proactively register in the system. For example, a user may want to watch the videos at home through a phone app or a web browser.

Security Concerns

Security is one of the most critical concerns in IoT, closely related to ethics, privacy and data responsibility. It must be integrated into every step of the system design. With millions of new devices connected every day, the number of potential attack points grows daily. With so much at stake, security engineering skills, including threat assessment, ethical hacking, encryption to ensure data integrity, protection of network architectures will necessary to be able to run IoT smoothly and securely.

By Yuuma




[Laravel] Bladeテンプレートエンジン(1)埋め込み構文編

PHPフレームワーク「Laravel」を使用する場合、Viewの作成は、Bladeテンプレートエンジンを使用することが一般的です。

Bladeテンプレートエンジンを使用することでHTMLへのPHPの埋め込みが簡単におこなえるようになります。

今回は、Bladeテンプレートで使用できる埋め込み構文を紹介したいと思います。

続きを読む

アプリ関連ニュース

お問い合わせはこちら

お問い合わせ・ご相談はお電話、またはお問い合わせフォームよりお受け付けいたしております。

tel. 06-6454-8833(平日 10:00~17:00)

お問い合わせフォーム