我正在使用Google AdSense尺寸。我有下面的数组,但我也允许用户输入自己的自定义广告尺寸。我希望他们的广告尺寸按照数组中的正确顺序排列。问题是当广告尺寸中的第二个数字超过999时,它就会出现故障。
$adsizes = array(
# Google Adsense Display and Text Unit Sizes
'970x90' => 'Large Leaderboard',
'728x90' => 'Leaderboard',
'468x60' => 'Banner ',
'336x280' => 'Large Rectangle',
'320x100' => 'Large Mobile Banner',
'320x50' => 'Mobile Banner',
'300x600' => 'Large Skyscraper',
'300x250' => 'Medium Rectangle',
'250x250' => 'Square ',
'234x60' => 'Half Banner',
'200x200' => 'Small Square',
'200x200' => 'Small Square',
'180x150' => 'Small Rectangle',
'160x600' => 'Wide Skyscraper',
'125x125' => 'Button',
'120x600' => 'Skyscraper',
'120x240' => 'Vertical Banner',
# Google Adsense Link Unit Sizes
'728x15' => 'Displays 4 links',
'468x15' => 'Displays 4 links',
'200x90' => 'Displays 3 links',
'180x90' => 'Displays 3 links',
'160x90' => 'Displays 3 links',
'120x90' => 'Displays 3 links',
);
例如,如果用户输入300x1050作为广告尺寸,如果我只是使用ksort()进行排序,则会在此处显示300x250广告以下。如何将300x1050的尺寸插入到正确的位置,在这种情况下刚好超过300x600?