Why this piece of code causes a 500 error on the site?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
9 views
Why this piece of code causes a 500 error on the site?

is the add_shortcode('in', 'in'); function in(){ global $post; if(get_post_meta($post->ID, 'work')){ $work = get_post_meta($post->ID, 'work'); foreach ($work as $options) { foreach ($options as $key) { if ($key == "in") { $hour = get_post_meta($post->ID, 'app_price_1hour'); $2hour = get_post_meta($post->ID, 'app_price_2hour'); $night = get_post_meta($post->ID, 'app_price_night'); $output = "ApartmentsPrice per hour: us$". $hour[0]."Price for 2 hours: us$". $2hour[0]."Price per night: us$". $night[0].""; return $output; } } } unset($work, $options, $key, $output, $hour, $2hour, $night); } }
by | 9 views

1 Answer

0 like 0 dislike
In PHP variable name cannot begin with a number. Rename the variable $2hour.
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
3 answers
asked Apr 14, 2019 by Denis9999
0 like 0 dislike
3 answers
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,405 users