Voting

: min(eight, three)?
(Example: nine)

The Note You're Voting On

info at callismart dot com dot ng
9 months ago
As of PHP 8.0, array_combine throws ValueError if the number of elements for each array is not equal;

To be on a safer side, you can perform a check instead.

$arrayk = array( 'key1', 'key2', 'key3' );
$arrayv = array( 'v1', 'v2', 'v3' );

if ( count( $arrayk ) === count( $arrayv ) ) {
echo '<pre>';
var_dump( array_combine( $arrayk, $arrayv ) );
echo '</pre>';
} else {
return false;
}

<< Back to user notes page

To Top