V
V
VPVPVP2021-06-13 13:20:03
PHP
VPVPVP, 2021-06-13 13:20:03

Display different text when a new user enters the site?

The task is this, there is a phone field in the product card, you need to conditionally set 10 numbers that will be displayed in a circle when the user opens the page. Well, that is, I went to the site, for example, the number is
+7923000000 Someone else went into the same product, his number is +7923111111, etc.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
nokimaro, 2021-06-13
@VPVPVP

<?php
$phone_nums = [
   '+7923000001',
   '+7923000002',
   '+7923000003',
   '+7923000004',
   '+7923000005',
];

$rand_phone = $phone_nums[array_rand($phone_nums)];
echo $rand_phone;

D
Dmitry Gadzhiev, 2021-06-13
@gds1

Make an array of numbers, and randomly take a number from it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question