Awesome q2a theme

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

0 like 0 dislike
39 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 | 39 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,187 answers
0 comments
40,796 users