Hướng dẫn unsupported operand types php

I have that code where i want to multiply corp_resp for corp_resp_template and sum dynamically.

$total = [array_reduce[[array_map[function[$x, $y] { return $x * $y; },
                   $corp_resp, $corp_resp_template]],function[$carry,$item]{return $carry+=$item;},0]];
echo $total;

Code:

 $valor[] = array[];
   foreach [ $_POST as $key => $value ]{

       $valor[] = $value;

corp_resp Output:

array[17] { [0]=> array[0] { } [1]=> string[4] "0.00" [2]=> string[4] "0.00" [3]=> string[4] "0.00" [4]=> string[4] "0.00" [5]=> string[4] "0.50" [6]=> string[4] "0.00" [7]=> string[4] "0.00" [8]=> string[4] "0.00" [9]=> string[4] "0.00" [10]=> string[4] "0.50" [11]=> string[4] "0.00" [12]=> string[4] "0.00" [13]=> string[4] "0.00" [14]=> string[4] "0.00" [15]=> string[4] "0.00" [16]=> string[4] "0.00" } 

Code:

$corp_resp_template = array[];

while [$mostrar = mysql_fetch_array[$consulta]] {

$corp_resp_template[] = $mostrar['corp_resp_template'];
}

corp_resp_template Output:

array[17] { [0]=> string[4] "0.15" [1]=> string[4] "0.15" [2]=> string[4] "0.15" [3]=> string[4] "0.15" [4]=> string[4] "0.15" [5]=> string[4] "0.15" [6]=> string[4] "0.15" [7]=> string[4] "0.15" [8]=> string[4] "0.15" [9]=> string[4] "0.15" [10]=> string[4] "0.15" [11]=> string[4] "0.15" [12]=> string[4] "0.15" [13]=> string[4] "0.15" [14]=> string[4] "0.15" [15]=> string[4] "0.15" [16]=> string[4] "0.15" } 

Is giving the following error: Fatal error: Unsupported operand types in C: Where the 2 are arrays.

Another doubt is how to work when i have corp_resp_template and i want to do the result for diferents corp_resp in the same function?

We’re getting a lot of errors on a page during and after saving and I’ve managed to track it down to the custom image size functionality.

PHP Fatal error:  Uncaught TypeError: Unsupported operand types: string * float in /site-path/wp-includes/media.php:467
Stack trace:
#0 /site-path/wp-includes/media.php[714]: wp_constrain_dimensions['1000', '', 300]
#1 /site-path/wp-includes/media.php[1376]: wp_image_matches_ratio[300, 300, '1000', '']
#2 /site-path/wp-includes/media.php[1067]: wp_calculate_image_srcset[Array, '//www.sit...', Array, 46296]
#3 /site-path/wp-content/plugins/elementor/includes/controls/groups/image-size.php[108]: wp_get_attachment_image[46296, 'square-sm', false, Array]
#4 /site-path/wp-content/plugins/elementor/includes/controls/groups/image-size.php[156]: Elementor\\Group_Control_Image_Size::get_attachment_image_html[Array, 'image', 'image']
#5 /site-path/wp-content/plugins/elementor/includes/widgets/image.php[701]: Elementor\\Group_Control_Image_Size::print_attachment_image_html[Array]
#6 /site-path/wp-content/plugins/elementor/includes/base/controls-stack.php[2223]: Elementor\\Widget_Image->render[]
#7 /site-path/wp-content/plugins/elementor/includes/base/widget-base.php[609]: Elementor\\Controls_Stack->render_by_mode[]
#8 /site-path/wp-content/plugins/elementor/includes/base/widget-base.php[750]: Elementor\\Widget_Base->render_content[]
#9 /site-path/wp-content/plugins/elementor/includes/base/element-base.php[447]: Elementor\\Widget_Base->print_content[]
#10 /site-path/wp-content/plugins/elementor/includes/base/element-base.php[787]: Elementor\\Element_Base->print_element[]
#11 /site-path/wp-content/plugins/elementor/includes/base/element-base.php[447]: Elementor\\Element_Base->print_content[]
#12 /site-path/wp-content/plugins/elementor/includes/base/element-base.php[787]: Elementor\\Element_Base->print_element[]
#13 /site-path/wp-content/plugins/elementor/includes/base/element-base.php[447]: Elementor\\Element_Base->print_content[]
#14 /site-path/wp-content/plugins/elementor/core/base/document.php[1627]: Elementor\\Element_Base->print_element[]
#15 /site-path/wp-content/plugins/elementor/core/base/document.php[1078]: Elementor\\Core\\Base\\Document->print_elements[Array]
#16 /site-path/wp-content/plugins/elementor/includes/frontend.php[1092]: Elementor\\Core\\Base\\Document->print_elements_with_wrapper[Array]
#17 /site-path/wp-content/plugins/elementor/includes/frontend.php[1006]: Elementor\\Frontend->get_builder_content[24]
#18 /site-path/wp-includes/class-wp-hook.php[307]: Elementor\\Frontend->apply_builder_in_content['

Chủ Đề