Skip to content

Tag: logic

Get Possible Order Date Based On Multiple Conditions

I can’t wrap my head around this particular problem. There is a bakery, and an office that accepts orders. Bakery is open from Monday to Sunday, it’s only closed during public holidays. Orders can be placed from Monday to Friday unless it’s a public holiday i.e. the office is open during wor…

How to round an integer UP to the nearest 15 in PHP

I have the INTEGER(255) variable $duration stored with a value taken from the user. I need to round this UP to the nearest 15. I have searched all over but haven’t been able to find a solution. How may I go about doing this? For example: 10 becomes 15 16 becomes 30 130 becomes 135 Also, how can I add

How I can create my own pow function using PHP?

I want to create a function in which I put two values (value and its power – Example function: multiply(3, 3) result 27). I have tried so far but failed, I have searched using Google but I have been unable to find any result because I don’t know the name of this function. What I want exactly: 3,3 …

MySQL GROUP_CONCAT with COLUMN SPLIT

I am working with a TABLE, need logical help. Check the below URL for the table structure and sample data. http://sqlfiddle.com/#!2/ece06/2 Table Schema: Inserted Data: Query: OutPUT: Expected OUTPUT: As you can see the output of the query has concat with comma. And currently we are doing string concat using …

Stuck with the number pattern printing in PHP

Stuck with the number pattern printing logic. Let me know what i am doing wrong as my file is simply going on execution without giving me a pattern. My Code — Pattern to achieve — UPDATE After applying new changes following are the screenshots — Answer Your error is in the last for, that sho…