PHP - DateTime::createFromFormat seems not to find the pattern - php

I have the following date: (Tue 7:00AM EST).
Now in order to change its format to 2014-01-21 7:00, I made use of DateTime:createFromFormat() and DateTime::format(). However, it does not seem to find the pattern in the string mentioned above.
Here's the code:
<?php
$date = DateTime::createFromFormat('(D g:iA T)', '(Tue 7:00AM EST)');
if($date !== false) {
var_dump($date->format('Y-m-d H:i'));
} else {
echo 'Invalid date!';
}
?>
Prints: Invalid Date!

Trim out the brackets:
$date = DateTime::createFromFormat('D g:iA T', trim('(Tue 7:00AM EST)', '()'));

print_r(DateTime::getLastErrors(),1); gave me:
Array (
[warning_count] => 0
[warnings] => Array
(
)
[error_count] => 1
[errors] => Array
(
[16] => Data missing
)
)
which means at index 16 of the string '(Tue 7:00AM EST)' there is data missing (at the last bracket).
echo print_r(DateTimeZone::listIdentifiers()); lists the following timezones
Array (
[0] => Africa/Abidjan
[1] => Africa/Accra
[2] => Africa/Addis_Ababa
[3] => Africa/Algiers
[4] => Africa/Asmara
[5] => Africa/Bamako
[6] => Africa/Bangui
[7] => Africa/Banjul
[8] => Africa/Bissau
[9] => Africa/Blantyre
[10] => Africa/Brazzaville
[11] => Africa/Bujumbura
[12] => Africa/Cairo
[13] => Africa/Casablanca
[14] => Africa/Ceuta
[15] => Africa/Conakry
[16] => Africa/Dakar
[17] => Africa/Dar_es_Salaam
[18] => Africa/Djibouti
[19] => Africa/Douala
[20] => Africa/El_Aaiun
[21] => Africa/Freetown
[22] => Africa/Gaborone
[23] => Africa/Harare
[24] => Africa/Johannesburg
[25] => Africa/Juba
[26] => Africa/Kampala
[27] => Africa/Khartoum
[28] => Africa/Kigali
[29] => Africa/Kinshasa
[30] => Africa/Lagos
[31] => Africa/Libreville
[32] => Africa/Lome
[33] => Africa/Luanda
[34] => Africa/Lubumbashi
[35] => Africa/Lusaka
[36] => Africa/Malabo
[37] => Africa/Maputo
[38] => Africa/Maseru
[39] => Africa/Mbabane
[40] => Africa/Mogadishu
[41] => Africa/Monrovia
[42] => Africa/Nairobi
[43] => Africa/Ndjamena
[44] => Africa/Niamey
[45] => Africa/Nouakchott
[46] => Africa/Ouagadougou
[47] => Africa/Porto-Novo
[48] => Africa/Sao_Tome
[49] => Africa/Tripoli
[50] => Africa/Tunis
[51] => Africa/Windhoek
[52] => America/Adak
[53] => America/Anchorage
[54] => America/Anguilla
[55] => America/Antigua
[56] => America/Araguaina
[57] => America/Argentina/Buenos_Aires
[58] => America/Argentina/Catamarca
[59] => America/Argentina/Cordoba
[60] => America/Argentina/Jujuy
[61] => America/Argentina/La_Rioja
[62] => America/Argentina/Mendoza
[63] => America/Argentina/Rio_Gallegos
[64] => America/Argentina/Salta
[65] => America/Argentina/San_Juan
[66] => America/Argentina/San_Luis
[67] => America/Argentina/Tucuman
[68] => America/Argentina/Ushuaia
[69] => America/Aruba
[70] => America/Asuncion
[71] => America/Atikokan
[72] => America/Bahia
[73] => America/Bahia_Banderas
[74] => America/Barbados
[75] => America/Belem
[76] => America/Belize
[77] => America/Blanc-Sablon
[78] => America/Boa_Vista
[79] => America/Bogota
[80] => America/Boise
[81] => America/Cambridge_Bay
[82] => America/Campo_Grande
[83] => America/Cancun
[84] => America/Caracas
[85] => America/Cayenne
[86] => America/Cayman
[87] => America/Chicago
[88] => America/Chihuahua
[89] => America/Costa_Rica
[90] => America/Creston
[91] => America/Cuiaba
[92] => America/Curacao
[93] => America/Danmarkshavn
[94] => America/Dawson
[95] => America/Dawson_Creek
[96] => America/Denver
[97] => America/Detroit
[98] => America/Dominica
[99] => America/Edmonton
[100] => America/Eirunepe
[101] => America/El_Salvador
[102] => America/Fortaleza
[103] => America/Glace_Bay
[104] => America/Godthab
[105] => America/Goose_Bay
[106] => America/Grand_Turk
[107] => America/Grenada
[108] => America/Guadeloupe
[109] => America/Guatemala
[110] => America/Guayaquil
[111] => America/Guyana
[112] => America/Halifax
[113] => America/Havana
[114] => America/Hermosillo
[115] => America/Indiana/Indianapolis
[116] => America/Indiana/Knox
[117] => America/Indiana/Marengo
[118] => America/Indiana/Petersburg
[119] => America/Indiana/Tell_City
[120] => America/Indiana/Vevay
[121] => America/Indiana/Vincennes
[122] => America/Indiana/Winamac
[123] => America/Inuvik
[124] => America/Iqaluit
[125] => America/Jamaica
[126] => America/Juneau
[127] => America/Kentucky/Louisville
[128] => America/Kentucky/Monticello
[129] => America/Kralendijk
[130] => America/La_Paz
[131] => America/Lima
[132] => America/Los_Angeles
[133] => America/Lower_Princes
[134] => America/Maceio
[135] => America/Managua
[136] => America/Manaus
[137] => America/Marigot
[138] => America/Martinique
[139] => America/Matamoros
[140] => America/Mazatlan
[141] => America/Menominee
[142] => America/Merida
[143] => America/Metlakatla
[144] => America/Mexico_City
[145] => America/Miquelon
[146] => America/Moncton
[147] => America/Monterrey
[148] => America/Montevideo
[149] => America/Montserrat
[150] => America/Nassau
[151] => America/New_York
[152] => America/Nipigon
[153] => America/Nome
[154] => America/Noronha
[155] => America/North_Dakota/Beulah
[156] => America/North_Dakota/Center
[157] => America/North_Dakota/New_Salem
[158] => America/Ojinaga
[159] => America/Panama
[160] => America/Pangnirtung
[161] => America/Paramaribo
[162] => America/Phoenix
[163] => America/Port-au-Prince
[164] => America/Port_of_Spain
[165] => America/Porto_Velho
[166] => America/Puerto_Rico
[167] => America/Rainy_River
[168] => America/Rankin_Inlet
[169] => America/Recife
[170] => America/Regina
[171] => America/Resolute
[172] => America/Rio_Branco
[173] => America/Santa_Isabel
[174] => America/Santarem
[175] => America/Santiago
[176] => America/Santo_Domingo
[177] => America/Sao_Paulo
[178] => America/Scoresbysund
[179] => America/Sitka
[180] => America/St_Barthelemy
[181] => America/St_Johns
[182] => America/St_Kitts
[183] => America/St_Lucia
[184] => America/St_Thomas
[185] => America/St_Vincent
[186] => America/Swift_Current
[187] => America/Tegucigalpa
[188] => America/Thule
[189] => America/Thunder_Bay
[190] => America/Tijuana
[191] => America/Toronto
[192] => America/Tortola
[193] => America/Vancouver
[194] => America/Whitehorse
[195] => America/Winnipeg
[196] => America/Yakutat
[197] => America/Yellowknife
[198] => Antarctica/Casey
[199] => Antarctica/Davis
[200] => Antarctica/DumontDUrville
[201] => Antarctica/Macquarie
[202] => Antarctica/Mawson
[203] => Antarctica/McMurdo
[204] => Antarctica/Palmer
[205] => Antarctica/Rothera
[206] => Antarctica/Syowa
[207] => Antarctica/Vostok
[208] => Arctic/Longyearbyen
[209] => Asia/Aden
[210] => Asia/Almaty
[211] => Asia/Amman
[212] => Asia/Anadyr
[213] => Asia/Aqtau
[214] => Asia/Aqtobe
[215] => Asia/Ashgabat
[216] => Asia/Baghdad
[217] => Asia/Bahrain
[218] => Asia/Baku
[219] => Asia/Bangkok
[220] => Asia/Beirut
[221] => Asia/Bishkek
[222] => Asia/Brunei
[223] => Asia/Choibalsan
[224] => Asia/Chongqing
[225] => Asia/Colombo
[226] => Asia/Damascus
[227] => Asia/Dhaka
[228] => Asia/Dili
[229] => Asia/Dubai
[230] => Asia/Dushanbe
[231] => Asia/Gaza
[232] => Asia/Harbin
[233] => Asia/Hebron
[234] => Asia/Ho_Chi_Minh
[235] => Asia/Hong_Kong
[236] => Asia/Hovd
[237] => Asia/Irkutsk
[238] => Asia/Jakarta
[239] => Asia/Jayapura
[240] => Asia/Jerusalem
[241] => Asia/Kabul
[242] => Asia/Kamchatka
[243] => Asia/Karachi
[244] => Asia/Kashgar
[245] => Asia/Kathmandu
[246] => Asia/Khandyga
[247] => Asia/Kolkata
[248] => Asia/Krasnoyarsk
[249] => Asia/Kuala_Lumpur
[250] => Asia/Kuching
[251] => Asia/Kuwait
[252] => Asia/Macau
[253] => Asia/Magadan
[254] => Asia/Makassar
[255] => Asia/Manila
[256] => Asia/Muscat
[257] => Asia/Nicosia
[258] => Asia/Novokuznetsk
[259] => Asia/Novosibirsk
[260] => Asia/Omsk
[261] => Asia/Oral
[262] => Asia/Phnom_Penh
[263] => Asia/Pontianak
[264] => Asia/Pyongyang
[265] => Asia/Qatar
[266] => Asia/Qyzylorda
[267] => Asia/Rangoon
[268] => Asia/Riyadh
[269] => Asia/Sakhalin
[270] => Asia/Samarkand
[271] => Asia/Seoul
[272] => Asia/Shanghai
[273] => Asia/Singapore
[274] => Asia/Taipei
[275] => Asia/Tashkent
[276] => Asia/Tbilisi
[277] => Asia/Tehran
[278] => Asia/Thimphu
[279] => Asia/Tokyo
[280] => Asia/Ulaanbaatar
[281] => Asia/Urumqi
[282] => Asia/Ust-Nera
[283] => Asia/Vientiane
[284] => Asia/Vladivostok
[285] => Asia/Yakutsk
[286] => Asia/Yekaterinburg
[287] => Asia/Yerevan
[288] => Atlantic/Azores
[289] => Atlantic/Bermuda
[290] => Atlantic/Canary
[291] => Atlantic/Cape_Verde
[292] => Atlantic/Faroe
[293] => Atlantic/Madeira
[294] => Atlantic/Reykjavik
[295] => Atlantic/South_Georgia
[296] => Atlantic/St_Helena
[297] => Atlantic/Stanley
[298] => Australia/Adelaide
[299] => Australia/Brisbane
[300] => Australia/Broken_Hill
[301] => Australia/Currie
[302] => Australia/Darwin
[303] => Australia/Eucla
[304] => Australia/Hobart
[305] => Australia/Lindeman
[306] => Australia/Lord_Howe
[307] => Australia/Melbourne
[308] => Australia/Perth
[309] => Australia/Sydney
[310] => Europe/Amsterdam
[311] => Europe/Andorra
[312] => Europe/Athens
[313] => Europe/Belgrade
[314] => Europe/Berlin
[315] => Europe/Bratislava
[316] => Europe/Brussels
[317] => Europe/Bucharest
[318] => Europe/Budapest
[319] => Europe/Busingen
[320] => Europe/Chisinau
[321] => Europe/Copenhagen
[322] => Europe/Dublin
[323] => Europe/Gibraltar
[324] => Europe/Guernsey
[325] => Europe/Helsinki
[326] => Europe/Isle_of_Man
[327] => Europe/Istanbul
[328] => Europe/Jersey
[329] => Europe/Kaliningrad
[330] => Europe/Kiev
[331] => Europe/Lisbon
[332] => Europe/Ljubljana
[333] => Europe/London
[334] => Europe/Luxembourg
[335] => Europe/Madrid
[336] => Europe/Malta
[337] => Europe/Mariehamn
[338] => Europe/Minsk
[339] => Europe/Monaco
[340] => Europe/Moscow
[341] => Europe/Oslo
[342] => Europe/Paris
[343] => Europe/Podgorica
[344] => Europe/Prague
[345] => Europe/Riga
[346] => Europe/Rome
[347] => Europe/Samara
[348] => Europe/San_Marino
[349] => Europe/Sarajevo
[350] => Europe/Simferopol
[351] => Europe/Skopje
[352] => Europe/Sofia
[353] => Europe/Stockholm
[354] => Europe/Tallinn
[355] => Europe/Tirane
[356] => Europe/Uzhgorod
[357] => Europe/Vaduz
[358] => Europe/Vatican
[359] => Europe/Vienna
[360] => Europe/Vilnius
[361] => Europe/Volgograd
[362] => Europe/Warsaw
[363] => Europe/Zagreb
[364] => Europe/Zaporozhye
[365] => Europe/Zurich
[366] => Indian/Antananarivo
[367] => Indian/Chagos
[368] => Indian/Christmas
[369] => Indian/Cocos
[370] => Indian/Comoro
[371] => Indian/Kerguelen
[372] => Indian/Mahe
[373] => Indian/Maldives
[374] => Indian/Mauritius
[375] => Indian/Mayotte
[376] => Indian/Reunion
[377] => Pacific/Apia
[378] => Pacific/Auckland
[379] => Pacific/Chatham
[380] => Pacific/Chuuk
[381] => Pacific/Easter
[382] => Pacific/Efate
[383] => Pacific/Enderbury
[384] => Pacific/Fakaofo
[385] => Pacific/Fiji
[386] => Pacific/Funafuti
[387] => Pacific/Galapagos
[388] => Pacific/Gambier
[389] => Pacific/Guadalcanal
[390] => Pacific/Guam
[391] => Pacific/Honolulu
[392] => Pacific/Johnston
[393] => Pacific/Kiritimati
[394] => Pacific/Kosrae
[395] => Pacific/Kwajalein
[396] => Pacific/Majuro
[397] => Pacific/Marquesas
[398] => Pacific/Midway
[399] => Pacific/Nauru
[400] => Pacific/Niue
[401] => Pacific/Norfolk
[402] => Pacific/Noumea
[403] => Pacific/Pago_Pago
[404] => Pacific/Palau
[405] => Pacific/Pitcairn
[406] => Pacific/Pohnpei
[407] => Pacific/Port_Moresby
[408] => Pacific/Rarotonga
[409] => Pacific/Saipan
[410] => Pacific/Tahiti
[411] => Pacific/Tarawa
[412] => Pacific/Tongatapu
[413] => Pacific/Wake
[414] => Pacific/Wallis
[415] => UTC
)
So there is not EST listed. However $date = DateTime::createFromFormat('T', 'EST'); works without problems, in contrast to $date = DateTime::createFromFormat('(T)', '(EST)');.
I could not manage to get exactly that example working, but maybe my mentioned thoughts can help you.
BTW: The following worked for me:
Removing the brackets (maybe the easiest solution)
$date = DateTime::createFromFormat('(D g:iA)', '(Tue 7:00AM)'); (without timezone)

You don't need to trim out the brackets, your date format can be parsed by \DateTime::createFromFormat() without any problems:-
$dateStr = "(Tue 7:00AM EST)";
$date = \DateTime::createFromFormat("(D g:iA T", $dateStr);
var_dump($date);
You will notice that the trick is to leave out the trailing ).
Output:-
object(DateTime)[1]
public 'date' => string '2014-01-21 07:00:00' (length=19)
public 'timezone_type' => int 2
public 'timezone' => string 'EST' (length=3)
See it working and the manual for formats accepted by DateTime::createFromFormat().

Related

PHP / imagecolorat : transform colors in RGB but missing colors

I'm trying to create a script producing histograms from JPG, PNGs,...
I can get all the colors pixels by pixels with imagecolorat but if I want to display them in CSS, I need to convert them in RGB.
I have used the following script which is available on many sites:
$r = ($a >> 16) & 0xFF;
$g = ($a >> 8) & 0xFF;
$b = $a & 0xFF;
$v = round(($r + $g + $b) / 3);
As I wanted to display the corresponding colors under my histogram, I did the following:
$mapping = array();
for ($a=0;$a<=16777215;$a++)
{
$r = ($a >> 16) & 0xFF;
$g = ($a >> 8) & 0xFF;
$b = $a & 0xFF;
$v = round(($r + $g + $b) / 3);
$mapping[$v] = $r.",".$g.",".$b;
}
The output of this array is the following:
Array
(
[0] => 1,0,0
[1] => 4,0,0
[2] => 7,0,0
[3] => 10,0,0
[4] => 13,0,0
[5] => 16,0,0
[6] => 19,0,0
[7] => 22,0,0
[8] => 25,0,0
[9] => 28,0,0
[10] => 31,0,0
[11] => 34,0,0
[12] => 37,0,0
[13] => 40,0,0
[14] => 43,0,0
[15] => 46,0,0
[16] => 49,0,0
[17] => 52,0,0
[18] => 55,0,0
[19] => 58,0,0
[20] => 61,0,0
[21] => 64,0,0
[22] => 67,0,0
[23] => 70,0,0
[24] => 73,0,0
[25] => 76,0,0
[26] => 79,0,0
[27] => 82,0,0
[28] => 85,0,0
[29] => 88,0,0
[30] => 91,0,0
[31] => 94,0,0
[32] => 97,0,0
[33] => 100,0,0
[34] => 103,0,0
[35] => 106,0,0
[36] => 109,0,0
[37] => 112,0,0
[38] => 115,0,0
[39] => 118,0,0
[40] => 121,0,0
[41] => 124,0,0
[42] => 127,0,0
[43] => 130,0,0
[44] => 133,0,0
[45] => 136,0,0
[46] => 139,0,0
[47] => 142,0,0
[48] => 145,0,0
[49] => 148,0,0
[50] => 151,0,0
[51] => 154,0,0
[52] => 157,0,0
[53] => 160,0,0
[54] => 163,0,0
[55] => 166,0,0
[56] => 169,0,0
[57] => 172,0,0
[58] => 175,0,0
[59] => 178,0,0
[60] => 181,0,0
[61] => 184,0,0
[62] => 187,0,0
[63] => 190,0,0
[64] => 193,0,0
[65] => 196,0,0
[66] => 199,0,0
[67] => 202,0,0
[68] => 205,0,0
[69] => 208,0,0
[70] => 211,0,0
[71] => 214,0,0
[72] => 217,0,0
[73] => 220,0,0
[74] => 223,0,0
[75] => 226,0,0
[76] => 229,0,0
[77] => 232,0,0
[78] => 235,0,0
[79] => 238,0,0
[80] => 241,0,0
[81] => 244,0,0
[82] => 247,0,0
[83] => 250,0,0
[84] => 253,0,0
[85] => 255,1,0
[86] => 255,4,0
[87] => 255,7,0
[88] => 255,10,0
[89] => 255,13,0
[90] => 255,16,0
[91] => 255,19,0
[92] => 255,22,0
[93] => 255,25,0
[94] => 255,28,0
[95] => 255,31,0
[96] => 255,34,0
[97] => 255,37,0
[98] => 255,40,0
[99] => 255,43,0
[100] => 255,46,0
[101] => 255,49,0
[102] => 255,52,0
[103] => 255,55,0
[104] => 255,58,0
[105] => 255,61,0
[106] => 255,64,0
[107] => 255,67,0
[108] => 255,70,0
[109] => 255,73,0
[110] => 255,76,0
[111] => 255,79,0
[112] => 255,82,0
[113] => 255,85,0
[114] => 255,88,0
[115] => 255,91,0
[116] => 255,94,0
[117] => 255,97,0
[118] => 255,100,0
[119] => 255,103,0
[120] => 255,106,0
[121] => 255,109,0
[122] => 255,112,0
[123] => 255,115,0
[124] => 255,118,0
[125] => 255,121,0
[126] => 255,124,0
[127] => 255,127,0
[128] => 255,130,0
[129] => 255,133,0
[130] => 255,136,0
[131] => 255,139,0
[132] => 255,142,0
[133] => 255,145,0
[134] => 255,148,0
[135] => 255,151,0
[136] => 255,154,0
[137] => 255,157,0
[138] => 255,160,0
[139] => 255,163,0
[140] => 255,166,0
[141] => 255,169,0
[142] => 255,172,0
[143] => 255,175,0
[144] => 255,178,0
[145] => 255,181,0
[146] => 255,184,0
[147] => 255,187,0
[148] => 255,190,0
[149] => 255,193,0
[150] => 255,196,0
[151] => 255,199,0
[152] => 255,202,0
[153] => 255,205,0
[154] => 255,208,0
[155] => 255,211,0
[156] => 255,214,0
[157] => 255,217,0
[158] => 255,220,0
[159] => 255,223,0
[160] => 255,226,0
[161] => 255,229,0
[162] => 255,232,0
[163] => 255,235,0
[164] => 255,238,0
[165] => 255,241,0
[166] => 255,244,0
[167] => 255,247,0
[168] => 255,250,0
[169] => 255,253,0
[170] => 255,255,1
[171] => 255,255,4
[172] => 255,255,7
[173] => 255,255,10
[174] => 255,255,13
[175] => 255,255,16
[176] => 255,255,19
[177] => 255,255,22
[178] => 255,255,25
[179] => 255,255,28
[180] => 255,255,31
[181] => 255,255,34
[182] => 255,255,37
[183] => 255,255,40
[184] => 255,255,43
[185] => 255,255,46
[186] => 255,255,49
[187] => 255,255,52
[188] => 255,255,55
[189] => 255,255,58
[190] => 255,255,61
[191] => 255,255,64
[192] => 255,255,67
[193] => 255,255,70
[194] => 255,255,73
[195] => 255,255,76
[196] => 255,255,79
[197] => 255,255,82
[198] => 255,255,85
[199] => 255,255,88
[200] => 255,255,91
[201] => 255,255,94
[202] => 255,255,97
[203] => 255,255,100
[204] => 255,255,103
[205] => 255,255,106
[206] => 255,255,109
[207] => 255,255,112
[208] => 255,255,115
[209] => 255,255,118
[210] => 255,255,121
[211] => 255,255,124
[212] => 255,255,127
[213] => 255,255,130
[214] => 255,255,133
[215] => 255,255,136
[216] => 255,255,139
[217] => 255,255,142
[218] => 255,255,145
[219] => 255,255,148
[220] => 255,255,151
[221] => 255,255,154
[222] => 255,255,157
[223] => 255,255,160
[224] => 255,255,163
[225] => 255,255,166
[226] => 255,255,169
[227] => 255,255,172
[228] => 255,255,175
[229] => 255,255,178
[230] => 255,255,181
[231] => 255,255,184
[232] => 255,255,187
[233] => 255,255,190
[234] => 255,255,193
[235] => 255,255,196
[236] => 255,255,199
[237] => 255,255,202
[238] => 255,255,205
[239] => 255,255,208
[240] => 255,255,211
[241] => 255,255,214
[242] => 255,255,217
[243] => 255,255,220
[244] => 255,255,223
[245] => 255,255,226
[246] => 255,255,229
[247] => 255,255,232
[248] => 255,255,235
[249] => 255,255,238
[250] => 255,255,241
[251] => 255,255,244
[252] => 255,255,247
[253] => 255,255,250
[254] => 255,255,253
[255] => 255,255,255
)
As you can see, there is already something wrong visible here because a whole bunch of colors are missing.
If I display those colors, I get this:
I started with the assumption that the max value for imagecolorat was 16777215. I got that value by asking the color index of a white pixel. Was I wrong?
Do you know how I could have a more accurate array of colors for my histogram?
Thanks
Blues and greens are completely missing.
You can create a loop for the 3 colors (red, green, blue) to get more distinct colors.
In the following example, you will get the black, red, green, blue, white (and many others).
Code: (demo)
$ndiv = 5; // small => less colors ; big => more colors
$div = 255 / $ndiv;
$mapping = [];
for ($r = 0; $r <= 255; $r += $div) {
for ($g = 0; $g <= 255; $g += $div) {
for ($b = 0; $b <= 255; $b += $div) {
$mapping[] = sprintf("%d,%d,%d", $r, $g, $b);
}
}
}
print_r($mapping);
Output:
Array
(
[0] => 0,0,0
[1] => 0,0,51
[2] => 0,0,102
[3] => 0,0,153
[4] => 0,0,204
[5] => 0,0,255
[6] => 0,51,0
[7] => 0,51,51
[8] => 0,51,102
[9] => 0,51,153
[10] => 0,51,204
[11] => 0,51,255
[12] => 0,102,0
[13] => 0,102,51
[14] => 0,102,102
[15] => 0,102,153
[16] => 0,102,204
[17] => 0,102,255
[18] => 0,153,0
[19] => 0,153,51
[20] => 0,153,102
[21] => 0,153,153
[22] => 0,153,204
[23] => 0,153,255
[24] => 0,204,0
[25] => 0,204,51
[26] => 0,204,102
[27] => 0,204,153
[28] => 0,204,204
[29] => 0,204,255
[30] => 0,255,0
[31] => 0,255,51
[32] => 0,255,102
[33] => 0,255,153
[34] => 0,255,204
[35] => 0,255,255
[36] => 51,0,0
[37] => 51,0,51
[38] => 51,0,102
[39] => 51,0,153
[40] => 51,0,204
[41] => 51,0,255
[42] => 51,51,0
[43] => 51,51,51
[44] => 51,51,102
[45] => 51,51,153
[46] => 51,51,204
[47] => 51,51,255
[48] => 51,102,0
[49] => 51,102,51
[50] => 51,102,102
[51] => 51,102,153
[52] => 51,102,204
[53] => 51,102,255
[54] => 51,153,0
[55] => 51,153,51
[56] => 51,153,102
[57] => 51,153,153
[58] => 51,153,204
[59] => 51,153,255
[60] => 51,204,0
[61] => 51,204,51
[62] => 51,204,102
[63] => 51,204,153
[64] => 51,204,204
[65] => 51,204,255
[66] => 51,255,0
[67] => 51,255,51
[68] => 51,255,102
[69] => 51,255,153
[70] => 51,255,204
[71] => 51,255,255
[72] => 102,0,0
[73] => 102,0,51
[74] => 102,0,102
[75] => 102,0,153
[76] => 102,0,204
[77] => 102,0,255
[78] => 102,51,0
[79] => 102,51,51
[80] => 102,51,102
[81] => 102,51,153
[82] => 102,51,204
[83] => 102,51,255
[84] => 102,102,0
[85] => 102,102,51
[86] => 102,102,102
[87] => 102,102,153
[88] => 102,102,204
[89] => 102,102,255
[90] => 102,153,0
[91] => 102,153,51
[92] => 102,153,102
[93] => 102,153,153
[94] => 102,153,204
[95] => 102,153,255
[96] => 102,204,0
[97] => 102,204,51
[98] => 102,204,102
[99] => 102,204,153
[100] => 102,204,204
[101] => 102,204,255
[102] => 102,255,0
[103] => 102,255,51
[104] => 102,255,102
[105] => 102,255,153
[106] => 102,255,204
[107] => 102,255,255
[108] => 153,0,0
[109] => 153,0,51
[110] => 153,0,102
[111] => 153,0,153
[112] => 153,0,204
[113] => 153,0,255
[114] => 153,51,0
[115] => 153,51,51
[116] => 153,51,102
[117] => 153,51,153
[118] => 153,51,204
[119] => 153,51,255
[120] => 153,102,0
[121] => 153,102,51
[122] => 153,102,102
[123] => 153,102,153
[124] => 153,102,204
[125] => 153,102,255
[126] => 153,153,0
[127] => 153,153,51
[128] => 153,153,102
[129] => 153,153,153
[130] => 153,153,204
[131] => 153,153,255
[132] => 153,204,0
[133] => 153,204,51
[134] => 153,204,102
[135] => 153,204,153
[136] => 153,204,204
[137] => 153,204,255
[138] => 153,255,0
[139] => 153,255,51
[140] => 153,255,102
[141] => 153,255,153
[142] => 153,255,204
[143] => 153,255,255
[144] => 204,0,0
[145] => 204,0,51
[146] => 204,0,102
[147] => 204,0,153
[148] => 204,0,204
[149] => 204,0,255
[150] => 204,51,0
[151] => 204,51,51
[152] => 204,51,102
[153] => 204,51,153
[154] => 204,51,204
[155] => 204,51,255
[156] => 204,102,0
[157] => 204,102,51
[158] => 204,102,102
[159] => 204,102,153
[160] => 204,102,204
[161] => 204,102,255
[162] => 204,153,0
[163] => 204,153,51
[164] => 204,153,102
[165] => 204,153,153
[166] => 204,153,204
[167] => 204,153,255
[168] => 204,204,0
[169] => 204,204,51
[170] => 204,204,102
[171] => 204,204,153
[172] => 204,204,204
[173] => 204,204,255
[174] => 204,255,0
[175] => 204,255,51
[176] => 204,255,102
[177] => 204,255,153
[178] => 204,255,204
[179] => 204,255,255
[180] => 255,0,0
[181] => 255,0,51
[182] => 255,0,102
[183] => 255,0,153
[184] => 255,0,204
[185] => 255,0,255
[186] => 255,51,0
[187] => 255,51,51
[188] => 255,51,102
[189] => 255,51,153
[190] => 255,51,204
[191] => 255,51,255
[192] => 255,102,0
[193] => 255,102,51
[194] => 255,102,102
[195] => 255,102,153
[196] => 255,102,204
[197] => 255,102,255
[198] => 255,153,0
[199] => 255,153,51
[200] => 255,153,102
[201] => 255,153,153
[202] => 255,153,204
[203] => 255,153,255
[204] => 255,204,0
[205] => 255,204,51
[206] => 255,204,102
[207] => 255,204,153
[208] => 255,204,204
[209] => 255,204,255
[210] => 255,255,0
[211] => 255,255,51
[212] => 255,255,102
[213] => 255,255,153
[214] => 255,255,204
[215] => 255,255,255
)
With $ndiv = 1, you'll get
Array
(
[0] => 0,0,0
[1] => 0,0,255
[2] => 0,255,0
[3] => 0,255,255
[4] => 255,0,0
[5] => 255,0,255
[6] => 255,255,0
[7] => 255,255,255
)
To get a continuation in colors, you can use HSL (Hue, Saturation, Luminosity). By moving the hue from 0 to 360°, you will get a full color wheel.
Here is an example for CSS property:
for ($h=0;$h<360;$h+=2) {
echo'<div style="background:hsl('.$h.',100%,50%);float:left;width:8px;height:12px;"></div>';
}
Output:
If you need a rgb() value, you can convert using this answer

How to get data which is not empty in cakephp

I am using cakephp 2.6.7. I have table named 'customers' where email is 'none' as default in table structure. I repeat it is not NULL as default. So when email field is empty then this field is not set as null. In this case how can I retrieve all data which is not empty. I tried this:
$customers = $this->Customer->find('list',
array('fields' => array('email'),
'conditions' => array('event_id' => $this->request->data['Product']['event_id'],
'not' => array('Customer.email' => null)
)
)
);
print_r($customers); gives the following result:
Array
(
[103] => shuvo2782#gmail.com
[104] => tanjimtasfia95#gmail.com
[105] => tsiddique10#gmail.com
[106] => mahrana78#gmail.com
[107] => snehomay#yahoo.com
[108] => raifurrhaim95#gmail.com
[109] => billahm9#gmail.com
[110] => rahamanraju27#gmail.com
[111] => shaiful019#gmail.com
[112] => tawhid.cse#gmail.com
[113] => minhaazulislaam#gmail.com
[114] => helalkhan32#gmail.com
[115] => mshuvo080#gmail.com
[116] => jahidiu#gmail.com
[117] => rezahimel#gmail.com
[118] => soniagazi123#yahoo.com
[119] => MDRAFIQUEL.ISLAM457#GMAIL.COM
[120] => khan7733305#gmail.com
[121] => khrimel#yahoo.com
[122] => Kawserrabbi3#gmail.com
[123] => mr.samirulhaque#gmail.com
[124] => tithydac#yahoo.com
[125] => iftefci#yahoo.com
[126] => nipabangla#gmail.com
[127] => asheke.elahi15#gmail.com
[128] => enam_moni#yahoo.com
[129] => tipshridoy#gmail.com
[130] => easirarafat95#yahoo.com
[131] => munem.sohan#yahoo.com
[132] => mdmamunkobi9#gmail.com
[133] => zarinnpn#gmail.com
[134] => antohin.munna#gmail.com
[135] => isratpriyanka36#gmail.com
[136] => lipa.bhuiyan#yahoo.com
[137] => ra.latifa94#gmail.com
[138] => rif007at#gmail.com
[139] => jayadnur#gmail.com
[140] => gopalthmdu09#gmail.com
[141] => mehedidon007#gmail.com
[142] => ahmd.shuhan#gmail.com
[143] => md.jami.94#gmail.com
[144] => prokash811#gmail.com
[145] => yiran786#gmail.com
[146] => akashecejkkniu#gmail.com
[147] => aktermowsumi#gmail.com
[148] => rhythm55#live.com
[149] => msisohan#yahoo.com
[150] => lizan1915#yahoo.com
[151] => mfrjnp#gmail.com
[152] => mithun.r0503#gmail.com
[153] => estiaqhasanthe#gmail.com
[154] => Mohinuddin817#gmail.com
[155] => meghlashokal25#gmail.com
[156] => mithun.r0503#hotmail.com
[157] => Sudipto004.ruet#gmail.Com
[158] => tetys.sourov#gmail.com
[159] => arefindipu464#gmail.com
[160] => zahirulislam425#gmail.com
[161] => ibrahimshaikhibu#gmail.com
[162] => www.zeromsi2#gmail.com
[163] => sabuj26#gmail.com
[164] => prince.munem.maruf#gmail.com
[165] => crossbonesdipu#gmail.com
[166] => iconfaysal2013#gmail.com
[167] => mosharof34#diit.info
[168] => drnira007#ymail.com
[169] => yeasinmina90#gmail.com
[170] => masudurism#gmail.com
[171] => shafiqklislamdch#gmail.com
[172] => wdxshohag#gmail.com
[173] => mostafij.hemal#gmail.com
[174] => miron.miron15#gmail.com
[175] => tanvir.hossain53#gmail.com
[176] => razuahammad#outlook.com
[177] => mohsin.akanda#gmail.com
[178] => iraz12729#gmail.com
[179] => mostainbillah96#gmail.com
[180] => munnarahman1994#gmail.com
[181] => olosut#yahoo.com
[182] => tope_olosu#yahoo.com
[183] => hamimulislam#gmail.com
[184] => Lipikhatun446#gmail.com
[185] => cse0607007#gmail.com
[186] => saim.shohag#gmail.com
[187] => rubiatrafi#gmail.com
[188] => jonalex628#gmail.com
[189] => mirashikul.haque14#gmail.com
[190] => rizvyr#gmail.com
[191] => mafuz619 Gmail . com
[192] => jahedul005#gmail.com
[193] => masuq2014#gmail.com
[194] => amrobi15#yahoo.com
[195] => asma#systechunimax.com
[196] => farzanaislam12#gmail.com
[197] =>
[198] =>
[199] =>
[200] =>
[201] =>
[202] =>
[203] =>
[204] =>
[205] =>
[206] =>
[207] =>
[208] =>
[209] =>
[210] =>
[211] =>
[212] =>
[213] =>
[214] =>
[215] =>
[216] =>
[217] =>
[218] =>
[219] =>
[220] =>
)
It logical that the email field is not null when no value for email is provided but I am trying to filtering this empty value telling as NOT NULL. Is there any way to solve this issues ?
Please add condition like
$customers = $this->Customer->find('list',
array('fields' => array('email'),
'conditions' => array('event_id' => $this->request->data['Product']['event_id'],
'AND' => array('not' => array('Customer.email' => null),'not' => array('Customer.email' => '')
)
)
);

How to break a long array into smaller arrays?

So, I have tried using array_slice and either I don't know what I am doing with it, or I need another solution. I have this long array that is being returned from a database. I need to break it into smaller arrays of sequential six elements so as to apply the right prices with the correct items. I realize that there is no data in many of the array elements. That is ok. Those represent where there isn't a price for a particular size with the particular item.
If someone can point me in the right direction, it will be greatly appreciated. Here is my array from a print_r.
Array ( [0] => [1] => [2] => [3] => 761 [4] => [5] => [6] => [7] => [8] => [9] => [10] => 823 [11] => 937 [12] => [13] => [14] => [15] => 701 [16] => [17] => [18] => [19] => [20] => [21] => [22] => 745 [23] => 854 [24] => [25] => [26] => [27] => 735 [28] => [29] => [30] => [31] => [32] => [33] => [34] => 985 [35] => 1067 [36] => [37] => [38] => [39] => 655 [40] => [41] => [42] => [43] => [44] => [45] => 658 [46] => [47] => [48] => [49] => [50] => [51] => [52] => 701 [53] => 807 [54] => [55] => [56] => [57] => 692 [58] => [59] => [60] => [61] => [62] => [63] => [64] => [65] => 1020 [66] => [67] => [68] => 1039 [69] => [70] => 1099 [71] => [72] => [73] => [74] => 1029 [75] => [76] => 1149 [77] => [78] => 659 [79] => 664 [80] => [81] => [82] => [83] => [84] => 714 [85] => [86] => [87] => [88] => [89] => [90] => [91] => 724 [92] => 724 [93] => 739 [94] => 759 [95] => [96] => [97] => [98] => [99] => [100] => 989 [101] => [102] => 599 [103] => [104] => [105] => [106] => [107] => [108] => [109] => 679 [110] => 674 [111] => 669 [112] => 689 [113] => [114] => [115] => [116] => [117] => [118] => 899 [119] => [120] => 599 [121] => [122] => [123] => [124] => [125] => [126] => [127] => 614 [128] => 609 [129] => 639 [130] => 634 [131] => [132] => [133] => [134] => [135] => [136] => 834 [137] => [138] => 584 [139] => [140] => [141] => [142] => [143] => [144] => [145] => 652 [146] => 659 [147] => 644 [148] => 649 [149] => [150] => [151] => [152] => [153] => [154] => 829 [155] => [156] => 674 [157] => [158] => [159] => [160] => [161] => [162] => [163] => 659 [164] => 774 [165] => 679 [166] => 719 [167] => 969 [168] => [169] => [170] => [171] => [172] => 994 [173] => [174] => [175] => [176] => [177] => 1100 [178] => [179] => [180] => [181] => [182] => [183] => [184] => 1215 [185] => [186] => [187] => [188] => [189] => [190] => [191] => 1334 [192] => [193] => [194] => [195] => 825 [196] => [197] => [198] => [199] => [200] => [201] => [202] => 898 [203] => 1045 [204] => [205] => [206] => [207] => 915 [208] => [209] => [210] => [211] => [212] => [213] => [214] => 1012 [215] => [216] => [217] => [218] => [219] => [220] => [221] => 1174 [222] => [223] => [224] => [225] => 963 [226] => [227] => 1224 [228] => [229] => [230] => [231] => 944 [232] => [233] => 1222 [234] => [235] => [236] => [237] => 819 [238] => [239] => [240] => [241] => [242] => [243] => 822 [244] => [245] => [246] => [247] => [248] => [249] => [250] => 891 [251] => 1016 [252] => [253] => [254] => [255] => 856 [256] => [257] => [258] => [259] => [260] => [261] => [262] => 1131 [263] => 1229 [264] => [265] => [266] => [267] => [268] => [269] => 1234 [270] => 972 [271] => [272] => [273] => [274] => [275] => [276] => [277] => [278] => 982 [279] => [280] => 1017 [281] => [282] => [283] => 937 [284] => 932 [285] => [286] => 947 [287] => [288] => 857 [289] => [290] => [291] => [292] => [293] => [294] => [295] => [296] => 867 [297] => [298] => 892 [299] => [300] => [301] => [302] => 917 [303] => [304] => 907 [305] => [306] => [307] => [308] => 1032 [309] => [310] => 977 [311] => [312] => [313] => [314] => [315] => [316] => 1307 [317] => [318] => [319] => [320] => [321] => [322] => 1182 [323] => [324] => [325] => [326] => [327] => [328] => 1322 [329] => [330] => [331] => [332] => [333] => 1019 [334] => [335] => [336] => [337] => [338] => [339] => [340] => [341] => 1265 [342] => [343] => [344] => [345] => 1019 [346] => [347] => [348] => [349] => [350] => [351] => [352] => 1093 [353] => 1265 )
This should work for you:
<?php
//As an example
$array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12);
//Splits the array into groups of 6
$array = array_chunk($array, 6);
print_r($array);
?>
Output:
Array
(
[0] => Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
)
[1] => Array
(
[0] => 7
[1] => 8
[2] => 9
[3] => 10
[4] => 11
[5] => 12
)
)

how to create a unique code with proper format

I want to create unique code iwth respect to particular selected item my unique code format is
FN1A,FN1B---------FN1Z After z loop is start again
FN2A,FN2B-----------FN2Z So on
Here i use this code
<?php
for($row=1; $row<=22; $row++){
echo "<tr>";
for ($column='A'; $column!='AA'; $column++){
echo "<td> $row $column </td>";
}
echo "</tr>";
}
?>
Please help me guys to create unique sample code with same format i mention in this
Try PHP Range
<?php
for($row=1; $row<=22; $row++){
echo "<tr>";
foreach (range('A', 'Z') as $char) { // Get A - Z as array
echo "FN{$row}{$char}"; //Concatenate as per your requirements
}
echo "</tr>";
}
?>
for($row=1; $row<=22; $row++){
echo "<tr>";
for ($column='A'; $column<='Z'; $column++){
echo "<td> FN".$row . $column." </td>";
}
echo "</tr>";
}
I know about the concatenate guys you concatenate with my logic but I have form with particular samples one i select the sample from dropdown one unique code genrate and insert into database
I think what you are missing is the range function in php, visit http://php.net/manual/en/function.range.php for detail information, I will leave you the example I built, regards.
<?php
$array_alb = range('A', 'Z');
$array_num = range('1', '9');
echo '<pre>';
print_r($array_alb);
echo '</pre><pre>';
print_r($array_num);
echo '</pre>';
$prefix = 'FN';
$result = array();
foreach ($array_num as $num)
{
foreach($array_alb as $letter)
{
$result[] = $prefix.$num.$letter;
}
}
echo '<pre>';
print_r($result);
echo '<pre>';
?>
Array
(
[0] => FN1A
[1] => FN1B
[2] => FN1C
[3] => FN1D
[4] => FN1E
[5] => FN1F
[6] => FN1G
[7] => FN1H
[8] => FN1I
[9] => FN1J
[10] => FN1K
[11] => FN1L
[12] => FN1M
[13] => FN1N
[14] => FN1O
[15] => FN1P
[16] => FN1Q
[17] => FN1R
[18] => FN1S
[19] => FN1T
[20] => FN1U
[21] => FN1V
[22] => FN1W
[23] => FN1X
[24] => FN1Y
[25] => FN1Z
[26] => FN2A
[27] => FN2B
[28] => FN2C
[29] => FN2D
[30] => FN2E
[31] => FN2F
[32] => FN2G
[33] => FN2H
[34] => FN2I
[35] => FN2J
[36] => FN2K
[37] => FN2L
[38] => FN2M
[39] => FN2N
[40] => FN2O
[41] => FN2P
[42] => FN2Q
[43] => FN2R
[44] => FN2S
[45] => FN2T
[46] => FN2U
[47] => FN2V
[48] => FN2W
[49] => FN2X
[50] => FN2Y
[51] => FN2Z
[52] => FN3A
[53] => FN3B
[54] => FN3C
[55] => FN3D
[56] => FN3E
[57] => FN3F
[58] => FN3G
[59] => FN3H
[60] => FN3I
[61] => FN3J
[62] => FN3K
[63] => FN3L
[64] => FN3M
[65] => FN3N
[66] => FN3O
[67] => FN3P
[68] => FN3Q
[69] => FN3R
[70] => FN3S
[71] => FN3T
[72] => FN3U
[73] => FN3V
[74] => FN3W
[75] => FN3X
[76] => FN3Y
[77] => FN3Z
[78] => FN4A
[79] => FN4B
[80] => FN4C
[81] => FN4D
[82] => FN4E
[83] => FN4F
[84] => FN4G
[85] => FN4H
[86] => FN4I
[87] => FN4J
[88] => FN4K
[89] => FN4L
[90] => FN4M
[91] => FN4N
[92] => FN4O
[93] => FN4P
[94] => FN4Q
[95] => FN4R
[96] => FN4S
[97] => FN4T
[98] => FN4U
[99] => FN4V
[100] => FN4W
[101] => FN4X
[102] => FN4Y
[103] => FN4Z
[104] => FN5A
[105] => FN5B
[106] => FN5C
[107] => FN5D
[108] => FN5E
[109] => FN5F
[110] => FN5G
[111] => FN5H
[112] => FN5I
[113] => FN5J
[114] => FN5K
[115] => FN5L
[116] => FN5M
[117] => FN5N
[118] => FN5O
[119] => FN5P
[120] => FN5Q
[121] => FN5R
[122] => FN5S
[123] => FN5T
[124] => FN5U
[125] => FN5V
[126] => FN5W
[127] => FN5X
[128] => FN5Y
[129] => FN5Z
[130] => FN6A
[131] => FN6B
[132] => FN6C
[133] => FN6D
[134] => FN6E
[135] => FN6F
[136] => FN6G
[137] => FN6H
[138] => FN6I
[139] => FN6J
[140] => FN6K
[141] => FN6L
[142] => FN6M
[143] => FN6N
[144] => FN6O
[145] => FN6P
[146] => FN6Q
[147] => FN6R
[148] => FN6S
[149] => FN6T
[150] => FN6U
[151] => FN6V
[152] => FN6W
[153] => FN6X
[154] => FN6Y
[155] => FN6Z
[156] => FN7A
[157] => FN7B
[158] => FN7C
[159] => FN7D
[160] => FN7E
[161] => FN7F
[162] => FN7G
[163] => FN7H
[164] => FN7I
[165] => FN7J
[166] => FN7K
[167] => FN7L
[168] => FN7M
[169] => FN7N
[170] => FN7O
[171] => FN7P
[172] => FN7Q
[173] => FN7R
[174] => FN7S
[175] => FN7T
[176] => FN7U
[177] => FN7V
[178] => FN7W
[179] => FN7X
[180] => FN7Y
[181] => FN7Z
[182] => FN8A
[183] => FN8B
[184] => FN8C
[185] => FN8D
[186] => FN8E
[187] => FN8F
[188] => FN8G
[189] => FN8H
[190] => FN8I
[191] => FN8J
[192] => FN8K
[193] => FN8L
[194] => FN8M
[195] => FN8N
[196] => FN8O
[197] => FN8P
[198] => FN8Q
[199] => FN8R
[200] => FN8S
[201] => FN8T
[202] => FN8U
[203] => FN8V
[204] => FN8W
[205] => FN8X
[206] => FN8Y
[207] => FN8Z
[208] => FN9A
[209] => FN9B
[210] => FN9C
[211] => FN9D
[212] => FN9E
[213] => FN9F
[214] => FN9G
[215] => FN9H
[216] => FN9I
[217] => FN9J
[218] => FN9K
[219] => FN9L
[220] => FN9M
[221] => FN9N
[222] => FN9O
[223] => FN9P
[224] => FN9Q
[225] => FN9R
[226] => FN9S
[227] => FN9T
[228] => FN9U
[229] => FN9V
[230] => FN9W
[231] => FN9X
[232] => FN9Y
[233] => FN9Z
)

print_r() prints out only 150 elements in array

I have an array $product_urls containing 200 elements.
Problem: When I do a print_r($product_urls), PHP prints out an array containing 150 elements, and the output appears to be truncated because its missing the closing ). I checked the HTML source code generated and it is indeed truncated at the 150th element. count($product_urls) gives 200.
This is puzzling. I'm using a PHP framework called Laravel. Any ideas?
PHP Code
echo "<pre>";
echo count($product_urls);
print_r($product_urls);
Output
200Array
(
[0] => http://www.example.com/mysite/mysite-Vest-With-Girl-Print/Prod/pgeproduct.aspx?iid=2409264
[1] => http://www.example.com/mysite/mysite-T-Shirt-With-Dork-Print/Prod/pgeproduct.aspx?iid=2483696
[2] => http://www.example.com/mysite/mysite-T-Shirt-With-Kasabian-Print/Prod/pgeproduct.aspx?iid=2428327
[3] => http://www.example.com/mysite/mysite-Long-Sleeve-Crew-Neck-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=2548469
[4] => http://www.example.com/Scotch-Soda/Scotch-And-Soda-T-Shirt-In-Washed-Cotton/Prod/pgeproduct.aspx?iid=2496980
//...
[147] => http://www.example.com/BePriv/Be-Priv-90210-Tiffany-T-shirt-Exclusive-To-mysite-UK/Prod/pgeproduct.aspx?iid=2262271
[148] => http://www.example.com/The-Quiet-Life/The-Quiet-Life-Start-Making-Sense-T-Shirt/Prod/pgeproduct.aspx?iid=2200659
[149] => http://www.example.com/The-Quiet-Life/The-Quiet-Life-Camera-Statue-T-Shirt/Prod/pgeproduct.aspx?iid=2200660
Entire Print_r Output (using Raheel Shan's method)
200Array
(
[0] => http://www.example.com/mysite/mysite-Vest-With-Girl-Print/Prod/pgeproduct.aspx?iid=2409264
[1] => http://www.example.com/mysite/mysite-T-Shirt-With-Dork-Print/Prod/pgeproduct.aspx?iid=2483696
[2] => http://www.example.com/mysite/mysite-T-Shirt-With-Kasabian-Print/Prod/pgeproduct.aspx?iid=2428327
[3] => http://www.example.com/mysite/mysite-Long-Sleeve-Crew-Neck-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=2548469
[4] => http://www.example.com/Scotch-Soda/Scotch-And-Soda-T-Shirt-In-Washed-Cotton/Prod/pgeproduct.aspx?iid=2496980
[5] => http://www.example.com/Scotch-Soda/Scotch-And-Soda-T-Shirt-with-Block-Hoop/Prod/pgeproduct.aspx?iid=2496983
[6] => http://www.example.com/Carhartt/Carhartt-Marker-T-Shirt/Prod/pgeproduct.aspx?iid=2453973
[7] => http://www.example.com/Levis-Vintage/Levis-Vintage-T-Shirt-1950-Sportswear/Prod/pgeproduct.aspx?iid=2270995
[8] => http://www.example.com/The-Quiet-Life/The-Quiet-Life-Camera-Club-T-shirt-Bike/Prod/pgeproduct.aspx?iid=2494276
[9] => http://www.example.com/Reclaimed-Vintage/Reclaimed-Vintage-Vest-with-Paisley-Peace-Print/Prod/pgeproduct.aspx?iid=2533797
[10] => http://www.example.com/Supreme-Being/Supremebeing-White-Canvas-Project-T-Shirt-Mr-Jago/Prod/pgeproduct.aspx?iid=2363025
[11] => http://www.example.com/Reclaimed-Vintage/Reclaimed-Vintage-T-Shirt-with-Tye-Dye-Print/Prod/pgeproduct.aspx?iid=2533633
[12] => http://www.example.com/Emporio-Armani/Emporio-Armani-Pure-Cotton-Crew-T-Shirt/Prod/pgeproduct.aspx?iid=1999130
[13] => http://www.example.com/mysite/mysite-T-Shirt-With-Layered-Print/Prod/pgeproduct.aspx?iid=2457845
[14] => http://www.example.com/Diesel/Diesel-T-Shirt-With-Stamp-Print/Prod/pgeproduct.aspx?iid=2441057
[15] => http://www.example.com/Diesel/Diesel-T-Shirt-With-Label-Print/Prod/pgeproduct.aspx?iid=2441126
[16] => http://www.example.com/Lee/Lee-T-Shirt-With-Play-Print/Prod/pgeproduct.aspx?iid=2425959
[17] => http://www.example.com/Lee/Lee-T-Shirt-With-Print/Prod/pgeproduct.aspx?iid=2426033
[18] => http://www.example.com/Lee/Lee-Grandad-Top/Prod/pgeproduct.aspx?iid=2425415
[19] => http://www.example.com/Nike-Skateboard/Nike-Skateboarding-T-Shirt-Speciman-Icon/Prod/pgeproduct.aspx?iid=2445650
[20] => http://www.example.com/American-Apparel/American-Apparel-Muscle-Tank/Prod/pgeproduct.aspx?iid=2503093
[21] => http://www.example.com/Religion/Religion-Safety-Pin-Skull-T-Shirt/Prod/pgeproduct.aspx?iid=2398683
[22] => http://www.example.com/Religion/Religion-Clash-Long-Sleeve-Top/Prod/pgeproduct.aspx?iid=2398419
[23] => http://www.example.com/American-Apparel/American-Apparel-Helvetica-T-Shirt-ZZ/Prod/pgeproduct.aspx?iid=2502997
[24] => http://www.example.com/American-Apparel/American-Apparel-Helvetica-T-Shirt-XX/Prod/pgeproduct.aspx?iid=2502998
[25] => http://www.example.com/American-Apparel/American-Apparel-3/4-Sleeve-Raglan-Top/Prod/pgeproduct.aspx?iid=2503354
[26] => http://www.example.com/Nike-Skateboard/Nike-Skateboarding-Laces-T-Shirt/Prod/pgeproduct.aspx?iid=2445588
[27] => http://www.example.com/mysite/mysite-T-Shirt-With-Animal-Print-Girl-Print/Prod/pgeproduct.aspx?iid=2410231
[28] => http://www.example.com/mysite/mysite-T-Shirt-With-Oxford-Pocket/Prod/pgeproduct.aspx?iid=2480313
[29] => http://www.example.com/mysite/mysite-Stripe-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=2420685
[30] => http://www.example.com/mysite/mysite-T-Shirt-With-Flag-Print/Prod/pgeproduct.aspx?iid=2484341
[31] => http://www.example.com/Cheap-Monday/Cheap-Monday-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2379675
[32] => http://www.example.com/Cheap-Monday/Cheap-Monday-Tor-T-Shirt/Prod/pgeproduct.aspx?iid=2379596
[33] => http://www.example.com/Hilfiger-Denim/Hilfiger-Denim-T-Shirt/Prod/pgeproduct.aspx?iid=2309725
[34] => http://www.example.com/Franklin-Marshall/Franklin-Marshall-T-Shirt/Prod/pgeproduct.aspx?iid=2360997
[35] => http://www.example.com/Denham/Denham-T-Shirt-Barnum-Pocket/Prod/pgeproduct.aspx?iid=2302619
[36] => http://www.example.com/Analog/Analog-Baseball-T-Shirt/Prod/pgeproduct.aspx?iid=2445332
[37] => http://www.example.com/Analog/Analog-T-shirt-Astro-Dot/Prod/pgeproduct.aspx?iid=2445516
[38] => http://www.example.com/Adidas-Originals/Adidas-Originals-T-Shirt-Stencil-Trefoil/Prod/pgeproduct.aspx?iid=2447712
[39] => http://www.example.com/Adidas-Originals/Adidas-Originals-T-Shirt-Fine-Stripe-Trefoil-Logo/Prod/pgeproduct.aspx?iid=2447613
[40] => http://www.example.com/Adidas-Originals/Adidas-Originals-Superstar-T-Shirt/Prod/pgeproduct.aspx?iid=2446200
[41] => http://www.example.com/Adidas-Originals/Adidas-Originals-Originals-Icon-T-Shirt/Prod/pgeproduct.aspx?iid=2446130
[42] => http://www.example.com/Adidas-Originals/Adidas-Originals-T-Shirt-Trefoil-Rasta/Prod/pgeproduct.aspx?iid=2349590
[43] => http://www.example.com/Adidas-Originals/Adidas-Originals-T-Shirt-Masking-Tape/Prod/pgeproduct.aspx?iid=2349584
[44] => http://www.example.com/Adidas-Originals/Adidas-Originals-Superstar-T-Shirt/Prod/pgeproduct.aspx?iid=2446162
[45] => http://www.example.com/Adidas-Originals/Adidas-Originals-Daily-Hustle-T-Shirt/Prod/pgeproduct.aspx?iid=2349550
[46] => http://www.example.com/G-Star/G-Star-T-Shirt-Elwood-Restany-Motorbike-Logo/Prod/pgeproduct.aspx?iid=2258870
[47] => http://www.example.com/mysite/mysite-Long-Sleeved-T-Shirt-With-Grandad-Collar-In-Pique-Jersey/Prod/pgeproduct.aspx?iid=2395254
[48] => http://www.example.com/Religion/Religion-Basic-Scoop-Neck-T-Shirt/Prod/pgeproduct.aspx?iid=1397435
[49] => http://www.example.com/mysite/mysite-Vest-With-Racer-Back/Prod/pgeproduct.aspx?iid=2457514
[50] => http://www.example.com/mysite/mysite-T-Shirt-With-Varsity-Print/Prod/pgeproduct.aspx?iid=2484233
[51] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-Log-In-T-Shirt/Prod/pgeproduct.aspx?iid=2366658
[52] => http://www.example.com/Ezra-Wine/Ezra-Wine-Medusa-T-Shirt/Prod/pgeproduct.aspx?iid=2383291
[53] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-Dropout-T-Shirt/Prod/pgeproduct.aspx?iid=2366535
[54] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-T-Shirt-with-Tongue-Pocket/Prod/pgeproduct.aspx?iid=2366527
[55] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-Going-to-Hell-T-Shirt/Prod/pgeproduct.aspx?iid=2366525
[56] => http://www.example.com/Denham/Denham-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=2511832
[57] => http://www.example.com/55DSL/55DSL-Hula-T-Shirt/Prod/pgeproduct.aspx?iid=2375696
[58] => http://www.example.com/55DSL/55DSL-Sky-T-Shirt/Prod/pgeproduct.aspx?iid=2375931
[59] => http://www.example.com/Selected/Selected-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2504193
[60] => http://www.example.com/Selected/Selected-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2504191
[61] => http://www.example.com/Selected/Selected-T-shirt-with-Double-Layer/Prod/pgeproduct.aspx?iid=2504184
[62] => http://www.example.com/Selected/Selected-T-Shirt-with-Double-Layer/Prod/pgeproduct.aspx?iid=2504135
[63] => http://www.example.com/Denham/Denham-T-Shirt-With-Scissor-Print/Prod/pgeproduct.aspx?iid=2511889
[64] => http://www.example.com/Replay/Replay-T-Shirt-With-V-Neck/Prod/pgeproduct.aspx?iid=2423227
[65] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-Patches-T-Shirt/Prod/pgeproduct.aspx?iid=2366648
[66] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-T-Shirt-with-FC-Stripe/Prod/pgeproduct.aspx?iid=2366533
[67] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-T-Shirt-with-Bandana-Pocket/Prod/pgeproduct.aspx?iid=2366528
[68] => http://www.example.com/Lazy-Oaf/Lazy-Oaf-End-is-Nigh-T-Shirt/Prod/pgeproduct.aspx?iid=2366425
[69] => http://www.example.com/Christopher-Shannon/Christopher-Shannon-Kidda-Laurel-T-Shirt/Prod/pgeproduct.aspx?iid=2323166
[70] => http://www.example.com/The-Quiet-Life/The-Quiet-Life-T-shirt-With-Cosmo-Pocket/Prod/pgeproduct.aspx?iid=2494015
[71] => http://www.example.com/Selected/Selected-T-Shirt-with-Pocket/Prod/pgeproduct.aspx?iid=2365377
[72] => http://www.example.com/Selected/Selected-Fleck-T-Shirt/Prod/pgeproduct.aspx?iid=2412803
[73] => http://www.example.com/mysite/mysite-T-Shirt-With-Aztec-Animal-Print/Prod/pgeproduct.aspx?iid=2412464
[74] => http://www.example.com/Worn-By/Worn-By-Neon-Tribal-T-Shirt/Prod/pgeproduct.aspx?iid=2305500
[75] => http://www.example.com/Worn-By/Worn-By-Hell-Yeah-T-Shirt/Prod/pgeproduct.aspx?iid=2305595
[76] => http://www.example.com/Religion/Religion-Razor-T-Shirt/Prod/pgeproduct.aspx?iid=2303944
[77] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-Paisley-Print-And-Contrast-Pocket/Prod/pgeproduct.aspx?iid=2405169
[78] => http://www.example.com/River-Island/River-Island-Vest-with-Surf-Print/Prod/pgeproduct.aspx?iid=2391220
[79] => http://www.example.com/Selected/Selected-Stripe-Vest/Prod/pgeproduct.aspx?iid=2299829
[80] => http://www.example.com/Selected/Selected-Stripe-Vest/Prod/pgeproduct.aspx?iid=2299786
[81] => http://www.example.com/River-Island/River-Island-Motel-Vest/Prod/pgeproduct.aspx?iid=2398677
[82] => http://www.example.com/River-Island/River-Island-Vest/Prod/pgeproduct.aspx?iid=2398569
[83] => http://www.example.com/River-Island/River-Island-Vest-with-Shanghai-Print/Prod/pgeproduct.aspx?iid=2391145
[84] => http://www.example.com/Cheap-Monday/Cheap-Monday-Mond-T-Shirt/Prod/pgeproduct.aspx?iid=2379599
[85] => http://www.example.com/Esprit/Esprit-Vest/Prod/pgeproduct.aspx?iid=2249197
[86] => http://www.example.com/Reclaimed-Vintage/Reclaimed-Vintage-Russian-Naval-T-Shirts/Prod/pgeproduct.aspx?iid=2274797
[87] => http://www.example.com/Worn-By/Worn-By-Zebra-T-Shirt/Prod/pgeproduct.aspx?iid=2305605
[88] => http://www.example.com/Savant/Savant-Fresh-T-Shirt/Prod/pgeproduct.aspx?iid=2187734
[89] => http://www.example.com/New-Love-Club/New-Love-Club-Nude-T-Shirt/Prod/pgeproduct.aspx?iid=2031399
[90] => http://www.example.com/Your-Eyes-Lie/Your-Eyes-Lie-All-for-You-Vest/Prod/pgeproduct.aspx?iid=1996304
[91] => http://www.example.com/People-Tree/People-Tree-Sydney-Vest/Prod/pgeproduct.aspx?iid=2072528
[92] => http://www.example.com/mysite/mysite-Vest-With-Aztec-Design/Prod/pgeproduct.aspx?iid=2351895
[93] => http://www.example.com/mysite/mysite-Vest-With-All-Over-Geo-Print/Prod/pgeproduct.aspx?iid=2373754
[94] => http://www.example.com/mysite/mysite-Stripe-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=2257136
[95] => http://www.example.com/mysite/mysite-Stripe-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=2257138
[96] => http://www.example.com/mysite/mysite-Crew-Long-Sleeve-Top-With-Pocket/Prod/pgeproduct.aspx?iid=1874647
[97] => http://www.example.com/mysite/mysite-T-Shirt-With-Flower-Print/Prod/pgeproduct.aspx?iid=2373623
[98] => http://www.example.com/mysite/mysite-Crew-Neck-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=1605761
[99] => http://www.example.com/mysite/mysite-T-Shirt-With-Skull-Print/Prod/pgeproduct.aspx?iid=2483379
[100] => http://www.example.com/mysite/mysite-T-Shirt-With-Sex-Pistols-Print/Prod/pgeproduct.aspx?iid=2420836
[101] => http://www.example.com/mysite/mysite-T-Shirt-With-Aztec-Girl-Print/Prod/pgeproduct.aspx?iid=2409391
[102] => http://www.example.com/mysite/mysite-T-Shirt-With-Camo-Print-And-Chambray-Pocket/Prod/pgeproduct.aspx?iid=2408949
[103] => http://www.example.com/mysite/mysite-T-Shirt-With-In-There-Like-Swimwear-Print/Prod/pgeproduct.aspx?iid=2404269
[104] => http://www.example.com/mysite/mysite-T-Shirt-With-Camo-Pocket/Prod/pgeproduct.aspx?iid=2336996
[105] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-Pattern/Prod/pgeproduct.aspx?iid=2367036
[106] => http://www.example.com/mysite/mysite-T-Shirt-With-Giant-Aztec-Print/Prod/pgeproduct.aspx?iid=2373696
[107] => http://www.example.com/mysite/mysite-Crew-Neck-T-Shirt-With-Pocket/Prod/pgeproduct.aspx?iid=2378610
[108] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-Space-Print/Prod/pgeproduct.aspx?iid=2368944
[109] => http://www.example.com/mysite/mysite-3/4-Sleeve-Top-In-Waffle-Jersey/Prod/pgeproduct.aspx?iid=2395846
[110] => http://www.example.com/mysite/mysite-Vest-With-Fluro-Stripe/Prod/pgeproduct.aspx?iid=2352422
[111] => http://www.example.com/mysite/mysite-Vest-With-David-Bowie-Print/Prod/pgeproduct.aspx?iid=2393776
[112] => http://www.example.com/mysite/mysite-T-Shirt-With-Shoulder-Patch/Prod/pgeproduct.aspx?iid=2364066
[113] => http://www.example.com/mysite/mysite-T-Shirt-With-Deep-V-Neck/Prod/pgeproduct.aspx?iid=2428120
[114] => http://www.example.com/mysite/mysite-T-Shirt-With-Shoulder-Patch/Prod/pgeproduct.aspx?iid=2375275
[115] => http://www.example.com/mysite/mysite-T-Shirt-With-Mystic-Eye-Print/Prod/pgeproduct.aspx?iid=2407356
[116] => http://www.example.com/mysite/mysite-T-Shirt-With-Aztec-Hem-Print/Prod/pgeproduct.aspx?iid=2371017
[117] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-Hula-Girl-Print/Prod/pgeproduct.aspx?iid=2407724
[118] => http://www.example.com/mysite/mysite-T-Shirt-With-Colorado-Print/Prod/pgeproduct.aspx?iid=2352880
[119] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-Print/Prod/pgeproduct.aspx?iid=2412241
[120] => http://www.example.com/mysite/mysite-Stripe-T-Shirt-With-Flag-Print/Prod/pgeproduct.aspx?iid=2363870
[121] => http://www.example.com/mysite/mysite-Vest-With-Tape-And-Pocket/Prod/pgeproduct.aspx?iid=2351801
[122] => http://www.example.com/mysite/mysite-Vest-USA-Flag-Print/Prod/pgeproduct.aspx?iid=2352165
[123] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-And-Double-Layer-Print/Prod/pgeproduct.aspx?iid=2364006
[124] => http://www.example.com/mysite/mysite-Long-Sleeve-Top-With-Deep-V/Prod/pgeproduct.aspx?iid=1873299
[125] => http://www.example.com/mysite/mysite-Stripe-T-Shirt-With-Two-Tone-Jersey-Marl/Prod/pgeproduct.aspx?iid=2368253
[126] => http://www.example.com/mysite/mysite-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2373649
[127] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-Aztec-Stripe/Prod/pgeproduct.aspx?iid=2405360
[128] => http://www.example.com/mysite/mysite-T-Shirt-With-All-Over-Print-And-Contrast-Neck-Trim/Prod/pgeproduct.aspx?iid=2412415
[129] => http://www.example.com/mysite/mysite-T-Shirt-With-Mask-Print/Prod/pgeproduct.aspx?iid=2412477
[130] => http://www.example.com/mysite/mysite-T-Shirt-With-Bill-And-Ted-Print/Prod/pgeproduct.aspx?iid=2320906
[131] => http://www.example.com/mysite/mysite-T-Shirt-With-Dip-Dye-Hem/Prod/pgeproduct.aspx?iid=2373764
[132] => http://www.example.com/mysite/mysite-Stripe-Vest/Prod/pgeproduct.aspx?iid=2250612
[133] => http://www.example.com/Solid/Solid-T-Shirt/Prod/pgeproduct.aspx?iid=2354420
[134] => http://www.example.com/mysite/mysite-T-Shirt-With-Printed-Woven-Pocket/Prod/pgeproduct.aspx?iid=2394637
[135] => http://www.example.com/mysite/mysite-T-Shirt-With-Printed-Woven-Pocket/Prod/pgeproduct.aspx?iid=2375274
[136] => http://www.example.com/mysite/mysite-T-Shirt-With-Fish-Print/Prod/pgeproduct.aspx?iid=2269490
[137] => http://www.example.com/Bellfield/Bellfield-Aztec-T-Shirt/Prod/pgeproduct.aspx?iid=2383222
[138] => http://www.example.com/Esprit/Esprit-T-Shirt-with-Surf-Print/Prod/pgeproduct.aspx?iid=2249271
[139] => http://www.example.com/mysite/mysite-T-Shirt-With-Rolled-Sleeves/Prod/pgeproduct.aspx?iid=2412631
[140] => http://www.example.com/Reclaimed-Vintage/Reclaimed-Vintage-Russian-Naval-T-Shirt/Prod/pgeproduct.aspx?iid=2274815
[141] => http://www.example.com/mysite/mysite-T-Shirt-With-Floral-Pocket-And-Yoke/Prod/pgeproduct.aspx?iid=2199554
[142] => http://www.example.com/mysite/mysite-T-Shirt-With-Eagle-Sunset-Print/Prod/pgeproduct.aspx?iid=2198894
[143] => http://www.example.com/Death-By-Zero/Death-by-Zero-Primal-Urge-T-Shirt/Prod/pgeproduct.aspx?iid=2352921
[144] => http://www.example.com/Death-By-Zero/Death-by-Zero-Nights-in-Manhattan-T-Shirt/Prod/pgeproduct.aspx?iid=2353016
[145] => http://www.example.com/Death-By-Zero/Death-by-Zero-Hit-the-Ground-T-Shirt/Prod/pgeproduct.aspx?iid=2353013
[146] => http://www.example.com/River-Island/River-Island-T-Shirt-with-Jazzy-Jeff-Print/Prod/pgeproduct.aspx?iid=2367043
[147] => http://www.example.com/BePriv/Be-Priv-90210-Tiffany-T-shirt-Exclusive-To-mysite-UK/Prod/pgeproduct.aspx?iid=2262271
[148] => http://www.example.com/The-Quiet-Life/The-Quiet-Life-Start-Making-Sense-T-Shirt/Prod/pgeproduct.aspx?iid=2200659
[149] => http://www.example.com/The-Quiet-Life/The-Quiet-Life-Camera-Statue-T-Shirt/Prod/pgeproduct.aspx?iid=2200660
[150] => http://www.example.com/Denim-Supply-by-Ralph-Lauren/Denim-Supply-by-Ralph-Lauren-Shield-Logo-T-Shirt/Prod/pgeproduct.aspx?iid=2214188
[151] => http://www.example.com/Clubbed-to-Death/Clubbed-to-Death-Tie-T-Shirt/Prod/pgeproduct.aspx?iid=2342946
[152] => http://www.example.com/Clubbed-to-Death/Clubbed-to-Death-RocknRoll-T-Shirt/Prod/pgeproduct.aspx?iid=2342949
[153] => http://www.example.com/Clubbed-to-Death/Clubbed-to-Death-Priviledge-T-Shirt/Prod/pgeproduct.aspx?iid=2343095
[154] => http://www.example.com/Clubbed-to-Death/Clubbed-to-Death-Ibiza-Rocks-T-Shirt/Prod/pgeproduct.aspx?iid=2342877
[155] => http://www.example.com/Clubbed-to-Death/Clubbed-to-Death-I-Heart-Cream-T-Shirt/Prod/pgeproduct.aspx?iid=2343085
[156] => http://www.example.com/Suit/Suit-Multistripe-T-Shirt/Prod/pgeproduct.aspx?iid=2245305
[157] => http://www.example.com/Suit/Suit-Marl-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2245454
[158] => http://www.example.com/Suit/Suit-Block-Colour-T-Shirt/Prod/pgeproduct.aspx?iid=2245089
[159] => http://www.example.com/mysite/mysite-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2250508
[160] => http://www.example.com/Worn-By/Worn-By-Rotten-Food-T-Shirt/Prod/pgeproduct.aspx?iid=2085029
[161] => http://www.example.com/mysite/mysite-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2250577
[162] => http://www.example.com/Jack-Jones-Vintage/Jack-Jones-Vintage-T-Shirt/Prod/pgeproduct.aspx?iid=2217454
[163] => http://www.example.com/Minimum/Minimum-Maidai-T-Shirt/Prod/pgeproduct.aspx?iid=2243906
[164] => http://www.example.com/American-Apparel/American-Apparel-Oversized-T-Shirt/Prod/pgeproduct.aspx?iid=2339752
[165] => http://www.example.com/Selected/Selected-Jimmy-Hendrix-T-Shirt/Prod/pgeproduct.aspx?iid=2191026
[166] => http://www.example.com/mysite/mysite-Vest-With-Leaf-Print-And-Pocket/Prod/pgeproduct.aspx?iid=2261785
[167] => http://www.example.com/Insight/Insight-Giddget-Must-Die-T-Shirt/Prod/pgeproduct.aspx?iid=2045641
[168] => http://www.example.com/Religion/Religion-Bramford-Pocket-Vest/Prod/pgeproduct.aspx?iid=2304093
[169] => http://www.example.com/Religion/Religion-Legs-T-Shirt/Prod/pgeproduct.aspx?iid=2303942
[170] => http://www.example.com/WESC/WESC-Puzzle-Overlay-T-Shirt/Prod/pgeproduct.aspx?iid=2187520
[171] => http://www.example.com/WESC/WESC-Icon-And-Stripes-T-Shirt/Prod/pgeproduct.aspx?iid=2187451
[172] => http://www.example.com/Revolution/Revolution-Stripe-Pocket-T-Shirt/Prod/pgeproduct.aspx?iid=2247329
[173] => http://www.example.com/mysite/mysite-Stripe-T-Shirt/Prod/pgeproduct.aspx?iid=2250507
[174] => http://www.example.com/Religion/Religion-Striped-Vest/Prod/pgeproduct.aspx?iid=2303946
[175] => http://www.example.com/Religion/Religion-Square-Pocket-T-Shirt/Prod/pgeproduct.aspx?iid=2304086
[176] => http://www.example.com/Religion/Religion-Scream-T-Shirt/Prod/pgeproduct.aspx?iid=2303943
[177] => http://www.example.com/Religion/Religion-Rest-in-Peace-T-Shirt/Prod/pgeproduct.aspx?iid=2303852
[178] => http://www.example.com/Religion/Religion-Low-V-T-Shirt/Prod/pgeproduct.aspx?iid=2304183
[179] => http://www.example.com/Religion/Religion-Gradient-T-Shirt/Prod/pgeproduct.aspx?iid=2303945
[180] => http://www.example.com/Religion/Religion-Basic-Vest/Prod/pgeproduct.aspx?iid=2304260
[181] => http://www.example.com/Religion/Religion-Rumours-T-Shirt/Prod/pgeproduct.aspx?iid=2304269
[182] => http://www.example.com/Esprit/Esprit-Pocket-Marl-Crew-Neck-T-Shirt/Prod/pgeproduct.aspx?iid=2257627
[183] => http://www.example.com/Sin-Star/Sin-Star-Live-Fast-T-Shirt/Prod/pgeproduct.aspx?iid=2274387
[184] => http://www.example.com/Savant/Savant-Sofa-T-Shirt/Prod/pgeproduct.aspx?iid=2187666
[185] => http://www.example.com/Savant/Savant-Puzzle-T-Shirt/Prod/pgeproduct.aspx?iid=2187664
[186] => http://www.example.com/Your-Eyes-Lie/Your-Eyes-Lie-Navo-Vest/Prod/pgeproduct.aspx?iid=1996309
[187] => http://www.example.com/Your-Eyes-Lie/Your-Eyes-Lie-Navo-T-Shirt/Prod/pgeproduct.aspx?iid=1996212
[188] => http://www.example.com/Esprit/Esprit-Pocket-Marl-Crew-Neck-T-Shirt/Prod/pgeproduct.aspx?iid=2255386
[189] => http://www.example.com/Your-Eyes-Lie/Your-Eyes-Lie-Ethnic-Animal-Vest/Prod/pgeproduct.aspx?iid=1996312
[190] => http://www.example.com/Polo-Ralph-Lauren/Polo-Ralph-Lauren-Anchor-Print-T-Shirt/Prod/pgeproduct.aspx?iid=2192627
[191] => http://www.example.com/Savant/Savant-Hello-Boys-T-Shirt/Prod/pgeproduct.aspx?iid=2187661
[192] => http://www.example.com/Jack-Jones-Vintage/Jack-Jones-Vintage-Surf-Shop-T-Shirt/Prod/pgeproduct.aspx?iid=2217196
[193] => http://www.example.com/Replay/Replay-Replay-T-Shirt-college-logo/Prod/pgeproduct.aspx?iid=2117989
[194] => http://www.example.com/Esprit/Esprit-Reverse-Pocket-Stripe-Crew-Neck-T-Shirt/Prod/pgeproduct.aspx?iid=2183750
[195] => http://www.example.com/Sin-Star/Sin-Star-Kill-Graphic-T-Shirt/Prod/pgeproduct.aspx?iid=2274447
[196] => http://www.example.com/Sin-Star/Sin-Star-Destroy-Graphic-T-Shirt/Prod/pgeproduct.aspx?iid=2274445
[197] => http://www.example.com/J-Lindeberg/J-Lindeberg-Scoop-Neck-T-Shirt/Prod/pgeproduct.aspx?iid=2228059
[198] => http://www.example.com/J-Lindeberg/J-Lindeberg-Fine-Stripe-T-Shirt-with-Pocket/Prod/pgeproduct.aspx?iid=2227948
[199] => http://www.example.com/mysite/mysite-Vest-With-Eagle-Print/Prod/pgeproduct.aspx?iid=2099899
)
The array is obviously correct, or at least it is 200 elements long.
The problem then is that Laravel probably does not expect you to shoot output using echo or var_dump or print_r, and "directly output'ed HTML" is likely to smash against some kind of output processor unless you leverage Laravel's Logger class.
It might be a coincidence, but your output size seems to fall around 16 Kb, which is the preferred buffer size of several processors/beautifiers/HTML cleaners.
What happens if you array_slice, say, the first 20 elements off the beginning of your array? Do only 130 elements get displayed, or do you still see 150 (more or less) elements?
Edit: if you really have to use echo, print_r or any "non-Laravel" method to output something quick&dirty, you may almost certainly do it like this:
// Open another output buffering context
ob_start();
print_r($WHATEVER);
$_output = ob_get_contents();
// Destroy the context so that Laravel's none the wiser
ob_end_clean();
$_fp = fopen("/tmp/myfile.txt", "w");
fwrite($_fp, $_output);
fclose($_fp);
// Remove awkward traces
unset($_fp, $_output);
You may also encapsulate the last part into a function of your own, so that you can write
// in helpers.php
function myObStop($file, $mode = 'a') {
$_output = ob_get_contents();
// Destroy the context so that Laravel's none the wiser
ob_end_clean();
$_fp = fopen($file, $mode);
fwrite($_fp, $_output);
fclose($_fp);
}
ob_start();
print "Whatever";
myObStop('/tmp/myfile.txt', 'w');
and leave Laravel executing after that. But I strongly advise to exploit Logger instead:
http://laravel.com/docs/logging#logging
When I test arrays I use this.
I'm pretty sure this is a default helper function called: dd()
$array; // That is 200 elements long.
var_dump($array);
die(); // Prevents html from being rendered if executed in the controller or model.
Every time I try to do this in my view it gets messed up by the HTML like Iserni said.

Categories