I am trying this code:
$rescntryvals[] = $rescntry;
$rescntry = "";
$resclkvalscntry[] = $rclick;
$rclick = "";
$resclkaddsnm[] = $addsnmame;
$addsnmame = "";
But I get this:
warning: Cannot use a scalar value as an array
Why? And what is the solution?
A scalar array is a fixed-length group of consecutive memory locations that each store a value of the same type. You access scalar arrays by referring to each location with an integer starting from zero. In D programs, you would usually use scalar arrays to access array data within the operating system.
Scalar variables are those containing an int, float, string or bool. Types array, object, resource and null are not scalar. Note: is_scalar() does not consider resource type values to be scalar as resources are abstract datatypes which are currently based on integers.
A scalar value is simply a value that only has one component to it, the magnitude. For example, your speed is a scalar value because it only has one component, how fast you are going. Your height is also a scalar value because the only component is how tall you are. The same goes for your mass.
There is one major difference between two of the main formats — scalar and array processors — in which a computer system processes information. While scalar processors work on one data item at a time, array processors can tackle multiple data streams simultaneously.
You have to declare $rescntryvals
as array before. Per default all variables are of type null
(undefined) until you define them.
$rescntryvals = array();
$rescntryvals[]=$rescntry;
Try this :
Declare the variables
$rescntryvals = array();
$rescntryvals[]=$rescntry;
OR
$rescntryvals = array($rescntry);
Ref: http://php.net/manual/en/language.types.array.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With