Skip to content
Advertisement

Tag: switch-statement

php- switch fails before i select an option

I’m having a problem with php switch function. I know it must be simple, but i’m just learning and I can’t seem to find the right way to code it. This is the issue: It works fine when you click any of the options, but it sends an error msg when I first load up the page… Now, I suppose

PHP switch statement problem causes a syntax error [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers. Closed 9 months ago. This post was

Why is my case within the switch query not always executed?

My Code: My test output (a small excerpt): The corresponding variable is integer and 60. | dump($zeilen[$i][‘satzart’]) And I have no idea why the function satz60() is not executed. (This can be seen in the test output, that no further values are output.) It is not relevant because I did a test output before calling satz60(), but this is what

How to use a Function of Switch/Case, if at all?

I have various products inside a database, each has its own price, the pattern to output a product price is: $product[i][“price”] I also have various “product types”, which are manually defined in my code, each with index number that will relate to each product accordingly: I want to echo a message according to the price, and to the type, for

Switch multiple case statement

Can someone suggest me how can I replace the below code? How do I rewrite the code in order to avoid the repetition of the block case 3:{code block A; break;}? How can I have combined code for case 1 and case 3? Answer This format is shown in the PHP docs: EDIT 04/19/2021: With the release of PHP8 and

Advertisement