I guys, pretty new to php and I couldn't find this answer in the manual. Basically if I have this situation:
$errors = array();
and I want to assign more than string to $error, depending on which input filed I'm testing, how do I do? I know I can do this for the first one:
$errors[] = 'You must select a title';
and that saves the string in $errors[0] But if afterwards I do:
$errors[] = 'Insert a first name';
what happens to the second string, is it saved in $error[1]? thanks
Yes, when you write:
$errors[] = 'something';
You push that value to the end of the Array.
Here you have an example
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.