Skip to content

Tag: php

Change time zone of gmdate PHP function

I am using the gmdate PHP function to insert the current date to the database but it shows GMT time , can I change it to my time zone +3 ? this is the code Answer “+3” is not a “timezone”. It’s an offset from UTC/GMT, which may change throughout the year based on DST settings. A …

PHP rotate matrix counter-clockwise

I am solving a larger problem and at one step I need to rotate a 2D array counter-clockwise. So if I have this matrix: After the rotation it will be: I have found a solution to rotate it clockwise: The thing is that this has to work even when a is uni-dimensional or has only one element. So, 1 2

SELECT id FROM table_name WHERE column = $variable

I’m trying to retrieve the id number of a record to use as a variable elsewhere. I only want the id from a record that has a particular value in another column. here is my code: When I test I get: SQL syntax; check the manual that corresponds to your MySQL server versi0on for the right syntax to use nea…

php for loop from array stops after 3 loops

I have an array that looks like this. I want to loop through array in the first key of [2] and echo all the values. this works, but stops after three loops and the output looks like this: I am expecting — hoping for this: I don’t understand why it is stopping. thanks. Answer Your problem lies here…