Skip to content
Advertisement

Tag: random

PHP: How to play random mp4 videos in static url .php

I have a code in PHP language hosted in webcindario.com (free hosting), that shows on click a video randomly. But it works ONLY in VLC Player for Windows. The result is that the Chrome browser or Android donĀ“t show the video: And I have these questions: Is there a way to get the code to work on Android devices and

php simple rand() look up taking long / crashing browser?

I’m running this code: First loads of the page are usually super fast. Then suddenly: Fatal error: Maximum execution time of 120 seconds exceeded It’s either working super fast or crashing. Can someone help me understand why this is? Thank You Answer You have committed a “logic” mistake. If $n1 = rand(1,20); sets $n1 to any number from 11 to

Shuffle() returns same results

I’m having a problem with using a basic shuffle() function in Laravel. It returns the same result, which seems to be changing once every 10 or 20 minutes. Here’s the basic code I’m testing: And here’s the log: Answer You probably initialize your random seed with a constant value somewhere else.

Generate save activation key as product key

I am trying to create a function which creates a random String. This String should consist of letters (only caps) and numbers. It will be used to activate a product. So the user has to type it into a text field. So far I found the following function: I do not have that much experience with random functions. So is

PHP – How to add more than 2 parameters to a variable?

So I have the following code: But it outputs this error: “Warning: rand() expects exactly 2 parameters, 10 given…” So I wonder how could I random the values of this variable and then print() only on in the p tag? Answer Since your numbers are in sequence, you could simply do Function Prototype: int rand ( int $min , int

Advertisement