Search Our Site

Our Newsletter

Our Ramblings

A look at some useful PHP functions. isset() vs empty() vs is_null()

Were currently developing a new system in collaboration with our partners at 802 Works – Redefining Wireless. As a part of that, were designing a new system for administering Wireless systems and maximising the marketing leverage that can be gained from them. That job involves having to write quite a lot of PHP pages and scripts. We thought we’d share a short tip on PHP variable declaration.

We’re going to look at the different ways that variables can be empty in this post. PHP has many different operators which can be used to test a variable. Three useful operators used for this are isset(), empty() and is_null(). Each of these operators return a boolean value (either true or false).

Lets take a look at these operators in a little more detail:

isset()

From the bible of PHP, the PHP manual, isset’s job is to “determine if a variable is set and is not NULL”. In other words, it returns true only when the variable is not null.

empty()

Again from the PHP manual, empty’s job is to “determine whether a variable is empty”. In other words, it will return true if the variable is an empty string, false, array(), NULL, “0?, 0, and an unset variable.

is_null()

Finally, from the PHP manual, is_null’s jobis to “find whether a variable is NULL”. In other words, it returns true only when the variable is null.

You may now be thinking that is_null() is opposite of isset() and , broadly speaking you’d be correct however there is one difference and that is that isset() can be applied to unknown variables, but is_null() only to declared variables.

The table below is an easy reference for what these functions will return for different values.

 

Value of variable ($var) isset($var) empty($var) is_null($var)
“” (an empty string) bool(true) bool(true)  bool(false)
” ” (space) bool(true)  bool(false)  bool(false)
FALSE bool(true) bool(true)  bool(false)
TRUE bool(true)  bool(false)  bool(false)
array() (an empty array) bool(true) bool(true)  bool(false)
NULL  bool(false) bool(true) bool(true)
“0” (0 as a string) bool(true) bool(true)  bool(false)
0 (0 as an integer) bool(true) bool(true)  bool(false)
0.0 (0 as a float) bool(true) bool(true)  bool(false)
var $var; (a variable declared, but without a value)  bool(false) bool(true) bool(true)
NULL byte (“\ 0”) bool(true)  bool(false)  bool(false)

 

I have tested the above values in PHP 7.1.9 which was released on September 1, 2017.

Designing Commercial WIFI Networks.

wifiWhen designing commercial WiFi networks, a wireless survey is an essential part of the design process. This can come in many forms but they can be broadly grouped into two main groupings, namely, the more conventional “walk around” style of survey or one done purely on the strength of detailed schematics of the location. It is easy to focus in on the prominent questions of signal strength and bandwidth however this should always be done in the context of the user experience at a given point on a given day with the network in full operational use.

Context

It is almost always the case that designing a commercial grade wifi network involves a good deal of groundwork including asking the users some fairly detailed questions about the location, the structure of the building, existing physical cable plant and associated infrastructure as well as local administrative practices. This information as well as detailed information about the required functionality of the new WIFI network including the key questions of coverage and capacity is fundamental to the creation of an effective rollout plan. It is important too at this stage to bear close account of the types of clients to be used on the eventual production network.

Performing the Survey

wisurvWhen designing a WiFi network, you have to consider how the network is going to look from the point of view of your WiFi clients – all of your clients. Clients come in a very wide variety of shapes, sizes and capabilities. Some may have good quality RF hardware and decent gain antennas, ensuring that they will have few issues in a reasonably well designed network. They should easily be able to connect to deployed APs and achieve SNR levels that ensure low error rates and good throughput.

However, other clients may have miniscule, poorly designed antennas, with low-cost, low quality RF circuitry. Their antennas may often be in a housing partially made of metal. They may have limited power available due to the power demands of a smartphone handset on a very limited battery. The explosion of mobile devices such as tablets and smartphone means that the majority of clients on a network may suffer these limitations . With the proliferation of these ‘less able’ clients, it is often best to be pessimistic about client capabilities when designing a wireless network and design for your ‘worst case’ clients.
We need to take a step back and think about the survey to be performed. What are we measuring? Are signal levels and SNR actually measured with a smartphone or tablet? The answer is: no. We will actually be measuring (in all likelihood) using a laptop with a USB wireless dongle that has very good RF capabilities. Will this survey ‘client’ see the network in the same way as a less capable tablet or smartphone? (The answer is no.)

An Alternative Point of View

In order to understand if this network is going to meet the design criteria laid down, we need to look at the survey data gathered from the point of view of the clients that will be using the network. As mentioned previously, we have to assume the worst, and design for our less able clients.

Back to the Drawing Board

Unfortunately, we now see huge holes in our coverage. We simply cannot meet the design criteria for our agreed limitations for less able devices in this network. We certainly have to add in enough access points, repositioning APs and perhaps winding up our AP transmit powers. There are other considerations that also need to be considered. These include factors such as client transmit power, client sensitivity and the varying CCI view of each client type. The key takeaway from this is that client capabilities need to factored in to design considerations – a survey using raw measurements is generally an invalid approach on today’s “support everything” networks.

Summary

cheaptabIn summary, we’ve taken a look at how we need to define design criteria for the type of wireless network that will meet customer requirements. Although we may be able to measure the design criteria using a professional survey tool, we need to be mindful of how the measurements are collected. Survey data gathered with a high-spec wireless NIC is generally going to see RF signals at higher levels than a lower spec mobile device.
When considering how effective our design will be in meeting the design criteria, we have to consider how the gathered RF data will look from the point of view of a actual clients that will use the network. Only then can we be sure of whether we can meet the design criteria and the customers’ requirements.

Wireless Body Area Networks

wbanWireless networking has become increasingly pervasive throughout our lives with the emergence of new communications technologies and techniques which have had a dramatic effect on the efficacy of the technology. As systems and ideas catch up with the tools available to them, one very interesting area which has been touched by wireless networking is that of the human body and its very immediate surroundings. Such networks are known as WBANs (Wireless Body Area Networks).

As a reasonably intimate application area, WBANs have found their primary usefulness to be in the medical arena. The demographics of the population of the world show it to be ageing fast as the baby boom generation moves up through the years. Around the world, governments and other interested agencies have begun to plan for the inevitable peak in the requirements for the care of the aged population. One potential advantage in dealing with the thorny problem they face is to use technology to leverage the effect of the limited resources they can bring to bear. Clinical areas such as Cancer Detection, Cardiovascular Diseases, Asthma Mitigation and Sleep Disorders can be positively impacted not to mention the broader areas the implants and wearable medical devices can bring to bear. Reaching further out, WBANs can also make a significant difference to the remote control of medical devices via telemedicine systems.

In short, the assistance provided by using WBANs is extremely significant however the adoption of the technology into the specific field has had to overcome some broad and significant challenges. These challenges can be broadly described as Architecture, Power Consumption, Data Rate and Security.

Lets take a look at how WBAN technology can be applied to the UK in the specific field of heart disease. Clearly heart disease is a leading cause of death for a significant percentage of the population. Appropriate and timely monitoring can prove to be a real asset in dealing with this condition and it is in this way that the benefits of WBANs can really be brought to bear. Systems have been developed such that, by the use of non intrusive miniaturised sensors, ambulatory monitoring of the most important metrics can be continued in real time as the patients go about their routines. The ubiquity of high speed mobile data networks in the UK means that, for the most part, this monitoring can continue uninterrupted for as long as is necessary. By carefully monitoring these vital signs, trained medical professionals can interpret the presence of problems, monitor deterioration and if necessary perform interventions.

In order to gain traction and mainstream acceptance in the United Kingdom, certain key issues had to be addressed. A hierarchical model for the architecture of WBANs has been developed such that  the devices are controlled by a central appliance known as a personal server. The model is flexible enough that it can be adapted to more specifically suit its use in specialised places such as a hospital or conversely broader scope areas out in the field.

Devices have had to be developed specifically for use in such an intimate way such that they do not exceed power outputs that are considered harmful to localised regions within the human body. A key measure known as the Specific Absorption Rate must not exceed the limits set out by various legislatures in the regions within which they operate. Institutional approval must be sought for each device that will operate in this specialised area. Furthermore, these specialised appliances, be they sensors or other devices must operate to very stringent limitations on their power consumption.

In order for the system to work within the context of a 21st century professional medical care system the governance framework around which the application is set out must be considerable. Lives can be lost if the system fails so it becomes imperative that systems failure modes and their consequences be carefully managed. Where there is potential for loss of life or serious non fatal consequences, steps must be in place to ensure that systems failure cannot take place.

pavAnother extremely important aspect which must be carefully managed is that of the security of medical WBAN systems. It almost goes without saying that, with systems that intrude into the most intimate areas of the human body that are charged with managing and effecting healthcare decisions, security is one of the most paramount concerns. Conventional network security, whilst strong, is by no means impenetrable. Appropriate systems of management, policy and operation need to run covalently with the key building blocks of security such as authentication, integrity and confidentiality. Complex encryption systems place demands upon processing as well as data rate overhead which serve to pull the design of the equipment away from the miniature. Broadly speaking therefore, a robust system must mesh together and operate flawlessly for the system to meet its mandatory requirements. Such standards require a strong governing entity to overarch the system and maintain its operation. The UK is well placed to provide this governing body and manage standards such as is necessary.

Looking contrastingly at Uzbekistan, where heart disease is a more significant issue, it becomes necessary to consider whether the resources available can ensure the necessary standards are met. It becomes perhaps necessary to rethink whether any of the standards which are necessarily adopted in an idealised situation such as is available in the UK can be relaxed. Standards of governance and their implementation and control require significant budget. Given the contrasting fiscal limitations in play in Uzbekistan one wonders perhaps if such actions and activities are appropriate.

In addition, looking at the figures for the penetration of networked data communication within the country, one also wonders if the infrastructure is in place to support such ambitions. One of the key unique selling points of the technology and its application is the ability for it to continue to operate with near ubiquity. In a country where the telecommunications infrastructure renders this nigh on impossible, it would seem to render the argument in favour of using the technology moot. Looking at both arguments it is therefore probably not a suitable technology for use in countries such as Uzbekistan with insufficient network infrastructure and very limited health budgets, tempting though the technology is.

WBANs present health professionals with unique opportunities to enhance medical care to levels previously unheard of and probably unachievable. With proper and effective management systems in place they represent a fantastic fillip to the broader toolset of medical practitioners. They will undoubtedly play an increasing part in health systems for many years to come.

Wireless Networking FAQ

feature-wifi-_v389686353_This wireless networking FAQ addresses common concerns about wireless networks. Learn the differences between wireless and wired networks and get an overview of the equipment you’ll need for a wireless network from these frequently asked questions (FAQ).

Wireless Networking FAQ: What is a Wireless Network?

A wireless local-area network (WLAN) uses radio waves to connect devices, such as laptops, to the Internet and to your business network and applications.

Wireless Networking FAQ: How Far Does the Signal Reach?

A wireless router or access point’s signal typically extends up to approximately 300 feet.

Wireless Networking FAQ: What is a Wired Network?

A wired network connects devices to the Internet or other networks using cables. Some believed wired networks were faster and more secure than WLANs. But continual enhancements to WLAN standards and technologies have largely erased those differences.

Wireless Networking FAQ: Who Uses WLANs?

WLANs are frequently offered in public places such as cafes, hotels, and airport lounges. In addition, many businesses have wireless networks throughout their office buildings or campuses for employee and guest use.

Wireless Networking FAQ: What Equipment Do I Need?

Many routers act as WLAN access points. They connect multiple computers (and wireless-capable printers) to a single WLAN and to the Internet.

You can extend WLANs throughout an area by placing additional wireless access points in various locations. The access points extend the wireless signal’s range and strength.

Most laptops have built-in wireless networking. If yours doesn’t, you’ll need a wireless network adapter card, which is typically inexpensive and easy to install.

Wireless Networking FAQ: How Can I Secure a WLAN?

There are many ways to secure your WLAN, including:

  • Data encryption, which only gives authorized users access to information over your wireless network
  • User authentication, which identifies computers trying to access the network
  • Secure access for visitors and guests
  • Control systems, which protect the laptops and other devices that use the network.

Wireless Networking FAQ: What are the Benefits of a WLAN?

Small businesses can experience many benefits from a WLAN. A few examples:

  • You can access network resources from any location within the wireless network’s coverage area.
  • Wireless access to the Internet and to company resources help your staff be more productive and collaborative.
  • You don’t have to string cables, as you do with wired networks. Installation can be quick and cost-effective.
  • You can easily expand WLANs where and as needed, because no wires are involved.
  • By eliminating or reducing wiring expenses, WLANs can cost less to operate than wired networks.