Created
October 8, 2013 07:40
-
-
Save umairidrees/6881038 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ar = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); | |
$ar_key = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20); | |
//URLs | |
$wer=5; //How Many Parts? | |
$count=count($ar); //Count Values | |
$prts=$count/$wer; //How many values comes in every Part | |
$i = 0; | |
$plus=$prts; | |
$t_urls=""; | |
//Keywords | |
$wer_key=5; //How Many Parts? | |
$count_key=count($ar_key); //Count Values | |
$prts_key=$count_key/$wer_key; //How many values comes in every Part | |
$i_key = 0; | |
$plus_key=$prts_key; | |
$t_keywords=""; | |
for ($z = 0; $z < $wer; $z++) { | |
$t_urls.="{"; | |
for ($i = $i; $i < $prts; $e=3) { | |
$t_urls.= $ar[$i]."|"; | |
$i++; | |
} $t_urls.="}"; | |
$t_keywords.="{"; | |
for ($i_key = $i_key; $i_key < $prts_key; $e_key=3) { | |
$t_keywords.= $ar_key[$i_key]."|"; | |
$i_key++; | |
}$t_keywords.="}"; | |
$all="[".$t_urls." ".$t_keywords."]"; | |
$all=str_replace("|}","}",$all); | |
echo $all; | |
echo "\n"; | |
// Plus minus things and empty the pockets | |
$prts_key=$prts_key+$plus_key; | |
$prts=$prts+$plus; | |
$t_urls=""; //Empty total URLs pocket so it can contain new in next round | |
$t_keywords=""; //Empty total keywords pocket so it can contain new in next round | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment