Answers for "how to increment a number after concatinating it with a date function in php"

PHP
7

php concat

$a = "hello";
$b = "world";
$c = $a . " " . $b;

echo $c; // hello world
Posted by: Guest on February-24-2020
0

how to increment a number after concatinating it with a date function in php

function generateId($existingIds) {
    $currentDate = date('Ymd');

    $id = 1;

    while (in_array($currentDate . sprintf('%02d', $id),$existingIds)) {
        $id++;
    }

    return $currentDate . sprintf('%02d', $id);
}
Posted by: Guest on June-25-2020
0

how to increment a number after concatinating it with a date function in php

$idArray = [];
array_push($idArray,generateId($idArray));
Posted by: Guest on June-25-2020

Code answers related to "how to increment a number after concatinating it with a date function in php"

Browse Popular Code Answers by Language