php - show unique links from array -
I have a function that shows a random banner from the array:
// func php Function rand_rek ($ rek_array) {$ numberOfBanners = count ($ rek_array); $ NumberAffancers = $ numberof banner-1; $ Random Banner = Rand (0, $ numberedBankers); $ Rek = $ rek_array [$ randomBanner]; $ Rek return; } I have an $ reklamas array, which has 3 banners: // ads.php $ reklamas = array ($ Rek1, $ rek2, $ rek3); If $ _GET ["noa"] is not correct, then I want to add more banners to $ reklamas array: if (! Isset ($ _GET) ["noa"])) array_push ($ reklamas, $ rek_adc1, $ rek_adc2, $ rek_adc3, $ rek_adc4);
And I want to display a random banner X bar:
for ($ i = 0; $ i ; $ banneri; $ I ++) {echo rand_reck ($ reklamas); } Problem: They can be repeated multiple times because they want the array ($ rek1, $ rek2, $ rek3); , while these Array_push ($ reklamas, $ rek_adc1, $ rek_adc2, $ rek_adc3, $ rek_adc4); Each can be shown only 1 time. The function is in rand_rek () func.php and this is happening from Ads.php, where is the rest of the code.
I think that you are probably going about this problem is all wrong, but any situation There can be a solution in
function rand_rek ($ rek_array) {$ numberOfBanners = count ($ rek_array); $ NumberAffancers = $ numberof banner-1; $ Random Banner = Rand (0, $ numberedBankers); $ Rek = $ rek_array [$ randomBanner]; Return [$ random banner, $ re]; } List ($ bannerNum, $ banner) = rand_rek ($ reklamas); If ($ banner no & lt; 3) {$ recurrence = $ x; } And {$ Repeats = 1; } ($ I = 0; $ i & lt; $ repeats; $ i ++) {echo $ banner; } which retrieves the banner indicator and checks it before loop is run. I have also used your value as $ x which you mentioned in the text but not in your code.
Comments
Post a Comment