Strange problem Max function cannot recognize parameters

Source: Internet
Author: User
Php

$CHRW = $this->getarrstringwidth ($chars, ",", 0, true); Array_walk ($CHRW, Array ($this, ' getrawcharwidth ')); $ Maxchwidth = max ($CHRW);

Report such a mistake Max () [Function.max]: Array must contain at least one element
I output $CHRW content before the Max function, which is an array ([1]=>6.35 [2]=>6.35 [3]=>6.35]


Reply to discussion (solution)

If I write Max (array (6.35,6.35,6.35)), the error disappears

Do the great gods know what's going on?? Why does the MAX function not recognize this parameter

This is the code of the Tcpdf class, I did not error local, but on the server on the error

$CHRW = $this->getarrstringwidth ($chars, ",", 0, true); Array_walk ($CHRW, Array ($this, ' getrawcharwidth ')); $ Maxchwidth = max ($CHRW);

Report such a mistake Max () [Function.max]: Array must contain at least one element
I output $CHRW content before the Max function, which is an array ([1]=>6.35 [2]=>6.35 [3]=>6.35]
The Max function must be able to put the variable, error description inside the array is problematic, array ([1]=>6.35 [2]=>6.35 [3]=>6.35]
I don't feel right about this array.

Array must contain at least one element
The array must contain at least one element



The Max function must be able to put the variable, error description inside the array is problematic, array ([1]=>6.35 [2]=>6.35 [3]=>6.35]
I don't feel right about this array.

I'm sorry, that's my handwriting, that's it.
Array
(
[0] = 6.35
[1] = 6.35
[2] = 6.35
)

Array must contain at least one element
The array must contain at least one element
The array is like this
Array
(
[0] = 6.35
[1] = 6.35
[2] = 6.35
)
There are elements inside the array.

Var_dump ($CHRW) Look what it is.

Var_dump ($CHRW) Look what it is.

Array (3) {[0]=> float (6.35) [1]=> float (6.35) [2]=> float (6.35)}

PHP is not mistaken, he said is empty so is empty!

$CHRW = $this->getarrstringwidth ($chars, ",", 0, true);
Var_dump ($CHRW);
Array_walk ($CHRW, Array ($this, ' getrawcharwidth '));
Var_dump ($CHRW);
$maxchwidth = max ($CHRW);

See for yourself.

PHP is not mistaken, he said is empty so is empty!

$CHRW = $this->getarrstringwidth ($chars, ",", 0, true);
Var_dump ($CHRW);
Array_walk ($CHRW, Array ($this, ' getrawcharwidth '));
Var_dump ($CHRW);
$maxchwidth = max ($CHRW);

See for yourself.

I did as you said, and looked at each other, but the output was
Array (3) {[0]=> float (6.35) [1]=> float (6.35) [2]=> float (6.35)}

PHP is not mistaken, he said is empty so is empty!

$CHRW = $this->getarrstringwidth ($chars, ",", 0, true);
Var_dump ($CHRW);
Array_walk ($CHRW, Array ($this, ' getrawcharwidth '));
Var_dump ($CHRW);
$maxchwidth = max ($CHRW);

See for yourself.

Array (3) {[0]=> float (6.35) [1]=> float (6.35) [2]=> float (6.35)} array (3) {[0]=> float (6.35) [1]=> float (6.35) [2]=> float (6.35)}

And, oddly enough, Max has an error, but my echo $maxchwidth turned out to be 6.35.

Supernatural Events
And locally yes, the server is wrong

Are the var_dump in your local test? To test on the wrong server.

And, oddly enough, Max has an error, but my echo $maxchwidth turned out to be 6.35.

Then you'll have to check if there's another place to use Max ().

Supernatural Events
And locally yes, the server is wrong

Are the var_dump in your local test? To test on the wrong server.
Well, that's the test on the server.


And, oddly enough, Max has an error, but my echo $maxchwidth turned out to be 6.35.

Then you'll have to check if there's another place to use Max ().

Max () [Function.max]: Array must contain at least one elementerror File: \includes\plugin\tcpdf\tcpdf.php on 6301 line.
>> report_issue
>> Back to previous page


And, oddly enough, Max has an error, but my echo $maxchwidth turned out to be 6.35.

Then you'll have to check if there's another place to use Max ().
To specify the number of lines, say in this line

Use Array_values ($CHRW) to try out the array before max calculation

Thank you, I don't know what's going on.

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.