I have $width
and $height
, which are random and represent the video's width and height.
If the video dimensions are greater then or equal to 1080p, it will create a 720p, 480p versions of the video, and so on.
If the dimensions are greater then or equal to 720p, it will create a 480p, 360p, and so on.
And this goes on...
I was using the following if statements to do this:
if($width >= 1920 && $height >= 1080)
{
// create 720p...
}
if($width >= 1280 && $height >= 720)
{
// create 480p...
}
But I figure that switch statements will be better if I won't use break
since if one case is true, it will execute all the other cases below without checking.
Is this the right approach? How would I apply this to a switch statement?