Joe Black
  • Member for 4 years, 9 months
  • Last seen more than 2 years ago
  • Mariupol, Ukraine
Append a incrementing number to a slug username
Accepted answer
3 votes

Searching for the slug duplicate in the database can be done in a more fast and straightforward way, by using = operator instead of like, and not using orderBy; To be on the safe side, it's worth to ...

View answer
Function/method to get selective columns
1 votes

I'd suggest your code to be rewritten like this (please, take note of the inline comments): <?php // Requires PHP >= 5.4 public function getRows($ntt, $cols = array(), $where = array(), $...

View answer
Codility cyclic rotation solution in PHP
1 votes

Actually, you don't need to rotate the initial array K times: <?php function solution($A, $K) { // when array is empty or has only one element if (count($A) == 0 || count($A) == 1) { ...

View answer
Check if a site is indexed by google and stores status in Database
1 votes

I would do the following optimization: $cxContext can be initialized outside the loop; use Last_Checked = NOW() in the UPDATE query, instead of $date = date('Y-m-d H:i:s'); set timezone in MySQL, not ...

View answer