Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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);
}
Comment

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

$idArray = [];
array_push($idArray,generateId($idArray));
Comment

PREVIOUS NEXT
Code Example
Php :: php form validation and submit to database 
Php :: Drupal get node id from view 
Php :: laravel echo server 
Php :: oder system make in laravel 
Php :: symfony translation variable in twig 
Php :: php composer copy library to public vendor folder 
Php :: pg_relation_size in mb 
Php :: how we generate a single column migration in laravel 
Php :: How to Filter Your Posts & Pages by Custom Field in WordPress Dashboard 
Php :: wordpress php get menu link page id 
Php :: php git pull webhook 
Php :: wordpress deny user to access wp-admin programmatically 
Php :: php printf percent sign 
Php :: get post date and time in wordpress 
Php :: stupidity 
Php :: htmlentities (PHP 4, PHP 5, PHP 7, PHP 8) htmlentities — Convert all applicable characters to HTML entities 
Php :: laravel creating event get data 
Php :: yii2 has many where 
Php :: delete request php-salesforce-rest-api 
Php :: New in initializers - PHP 8.1 
Php :: laravel how to call function in same controller 
Php :: php 8 constructor property promotion 
Php :: wordpress function _() not working 
Php :: wordpress curl wp remote post timeout error 
Php :: laravel count 
Php :: set modes magento 2 
Php :: how to share count of things to sidebar in laravel 
Php :: Send Message from server laravel 
Php :: wordpress not recognizing function during plugin activation 
Php :: order table in laravel 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =