Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php add number to the existing name

$name = 'foo';
$first_name = $name;
$i = 0;
do {
  //Check in the database here
  $exists = exists_in_database($name);
  if($exists) {
    $i++;
    $name = $first_name . $i;
  }
}while($exists);
//save $name
Comment

PREVIOUS NEXT
Code Example
Php :: how to get today week month ad year data in eloquent 
Php :: change apply coupon text woocommerce 
Php :: create a button add in laravel 
Php :: * * * * * cd /path-to-your-project && php artisan schedule:run /dev/null 2&1 
Php :: CONVERTIR TABLEAU EN CHAINE DE CARACTÈRE PHP 
Php :: while in php 
Php :: laravel collection take 
Php :: livewire calendar for laravel 9 
Php :: php Convert multidimensional array into single array 
Php :: twig render to string 
Php :: laravel faker value or null 
Php :: laravel php what does compact 
Php :: php two array difference merge recursive 
Php :: laravel get route action 
Php :: decrypted password php 
Php :: how to create route in laravel 
Php :: symfony twig variable 
Php :: php break and continue 
Php :: guzzle login example 
Php :: What was the old name of PHP? 
Php :: laravel add parameter to request 
Php :: laravel where in query builder 
Php :: php artisan app:name in laravel 6 
Php :: template engine php 
Php :: gate and policy in laravel 
Php :: laravel validation rule 
Php :: check if is the last day of the month php 
Php :: Undefined index: name laravel 
Php :: PHP Custom Time Ago Function 
Php :: include vendor/autoload.php 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =