The goal here is to create an array of messages and test if it is empty. If it is then the form can be processed.
Create an array
This example was taken from the PHP Manual - I added a bit more formatting.
The print_r() function prints the contents of the array (or any variable for that matter) in a human readable form.
Create a simple array.Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 )Array ( )
Array ( [5] => 6 )
Array ( [0] => 6 [1] => 7 )
Setting and testing for an empty array
From what I can gather from the PHP manual there is a potential problem here as "empty" is a "reserved" word.
Array() is an empty array. (see above)
Links
- Main PHP page
- Village Hall Template - at the moment I am check 2 error meaasges - the Hall Booking had 8
External Sources
- PHP.net on Arrays - 🔗
- print_r - 🔗