How to make images displayed with a certain frequency. for example, with a frequency of 60% of cases.

  • 2
    if( rand(0,100) < 60 ) { show_image(); } if( rand(0,100) < 60 ) { show_image(); } - you about it? - PinkTux
  • @PinkTux, but not 60% of the time, I can see the page and the picture a hundred times, but I can never see. Although the comment is good. - Naumov
  • @Naumov, OK, with a 60% probability :) A clarification is required. 60 first times out of a hundred, guaranteed 60 times out of a hundred with a random spread? Then you need to start external counters for page load / picture display and track them. - PinkTux 2:41 pm

1 answer 1

You need somewhere to write down how many times $view from among all $all calls.

 if ($view/$all >= 0.6 ) { не показывать }