Skip to content

PHP -> Next nearest date defined by array of days in week

please, really need help with this problem. I have array of offerDays – $offerDays = array(1,6); (mean Monday, and Saturday); For example, input date is Wednesday 2014/09/03. Next available date for offers is Saturday 2014/09/06 Question: How I can in php determine nearest next day? Something like Answe…

How can I use strlen in php for Persian?

I have this code: $string = ‘علی’; echo strlen($string); Since $string has 3 Persian characters, output must be 3 but I get 6. علی has 3 characters. Why my output is 6 ? How can I use strlen() in …

MySQLI Fetch Database Column

I have database table options, where am using it as a dedicated table to store information. I have never heard of this type of table query and have never tried it. I saw on WordPress database so thought to try my own. Here’s database table This is what am trying now This is inside my database class file…

How is it possible to run an ftp server, using php?

I would like to host az FTP server on: mywebsite.domain/ftpserver.php The XAMPP server runs on my computer. The php is important, because I would like to authenticate the users using their passwords in the mysql database, and their directory’s name is also stored in the database. Or if there is a free f…

Regex validation matching pattern1 and pattern2 in PHP

I need to match a string against two patterns both patterns must match the string. You could imagine it as some sort of validation chain. Patterns in below code are just examples. I know code below is a possible solution, but I’m interested to know can it be done with one preg_match by joining patterns …