<?php $data = <<<'EOD' [email protected]:JaD112456 | Country = US | Plan = Standard | Billing = September 5, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:Tiaja147375! | Country = US | Plan = Standard | Ads = True | Billing = November 15, 2023 | Payment = CC | Phone = (937) 367-0531 [email protected]:Mville93* | Country = US | Plan = Premium | Billing = November 17, 2023 | Payment = CC | Phone = (948) 202-0571 [email protected]:jakobe84 | Country = US | Plan = Standard | Ads = True | Billing = November 1, 2023 | Payment = CC | Phone = (717) 430-3728 [email protected]:Kevinkaleb1! | Country = US | Plan = Standard | Billing = November 3, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (847) 946-1175 [email protected]:Destanei@06 | Country = US | Plan = Standard | Ads = True | Billing = November 3, 2023 | Payment = CC | Phone = (757) 650-5593 [email protected]:brando88 | Country = GB | Plan = Premium | Billing = 26 August 2023 | Payment = SKY_UK_IE_BILLED | Partner = Sky | Phone = 07801 704596 [email protected]:Thatsall1216 | Country = US | Plan = Standard | Ads = True | Billing = November 5, 2023 | Payment = CC | Phone = (606) 794-5843 [email protected]:Tonyt2323! | Country = US | Plan = Standard | Billing = July 20, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:Lansmom!23 | Country = US | Plan = Standard | Billing = November 9, 2023 | Payment = COMCAST | Partner = Xfinity [email protected]:Bigfoot1967 | Country = GB | Plan = Standard | Ads = True | Billing = 18 November 2023 | Payment = PAYPAL | Phone = 07949 418423 [email protected]:Trigun98 | Country = US | Plan = Premium | Billing = September 7, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:123Wilfred! | Country = CA | Plan = Standard | Billing = 28 octobre 2023 | Payment = CC | Phone = (581) 777-8747 [email protected]:Ronney123 | Country = GB | Plan = Standard | Billing = 7 December 2022 | Payment = SKY_UK_IE_BILLED | Partner = Sky | Phone = 07756 696651 [email protected]:Gizmo777 | Country = US | Plan = Standard | Billing = October 13, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:Nani.B2011 | Country = US | Plan = Standard | Billing = July 16, 2022 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (707) 330-7336 [email protected]:Shanbett123 | Country = US | Plan = Premium | Billing = October 24, 2023 | Payment = COMCAST | Partner = Xfinity [email protected]:Leahjax1 | Country = GB | Plan = Premium | Billing = 27 March 2019 | Payment = SKY_UK_IE_BILLED | Partner = Sky [email protected]:Aziz1982! | Country = GB | Plan = Premium | Billing = 10 May 2019 | Payment = SKY_UK_IE_BILLED | Partner = Sky | Phone = 07922 219410 [email protected]:Creed1718@ | Country = US | Plan = Standard | Billing = November 13, 2023 | Payment = CC | Phone = (336) 344-0385 [email protected]:Bentleysam.123 | Country = US | Plan = Standard | Ads = True | Billing = November 18, 2023 | Payment = CC [email protected]:katyg1987 | Country = GB | Plan = Standard | Billing = 21 January 2019 | Payment = SKY_UK_IE_BILLED | Partner = Sky [email protected]:CharlotteZ1! | Country = US | Plan = Premium | Billing = October 28, 2023 | Payment = CC | Phone = (503) 602-4263 [email protected]:Herrera1955 | Country = US | Plan = Standard | Billing = September 29, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:Layb2311! | Country = US | Plan = Premium | Billing = November 10, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (910) 224-6920 [email protected]:topfer46 | Country = GB | Plan = Standard | Billing = 26 January 2020 | Payment = SKY_UK_IE_BILLED | Partner = Sky [email protected]:Shamika_30 | Country = US | Plan = Premium | Billing = February 8, 2023 | Payment = COMCAST_BILLED | Partner = Xfinity [email protected]:creeter1 | Country = US | Plan = Standard | Ads = True | Billing = November 4, 2023 | Payment = CC | Phone = (602) 373-2933 [email protected]:Tish5980! | Country = US | Plan = Premium | Billing = November 21, 2023 | Payment = CC [email protected]:Loombands11 | Country = GB | Plan = Premium | Billing = 17 November 2023 | Payment = CC | Phone = 07957 082576 [email protected]:Sweetie1! | Country = US | Plan = Standard | Ads = True | Billing = October 27, 2023 | Payment = CC | Phone = (215) 804-8861 [email protected]:Reeree09 | Country = US | Plan = Standard | Ads = True | Billing = November 11, 2023 | Payment = CC | Phone = (404) 957-1283 [email protected]:Coco2003! | Country = US | Plan = Standard | Ads = True | Billing = October 30, 2023 | Payment = CC | Phone = (949) 547-9681 [email protected]:Shivsterr24! | Country = US | Plan = Standard | Ads = True | Billing = November 11, 2023 | Gift = $17.45 [January 26, 2024] | Payment = GIFT | Phone = (347) 694-0703 [email protected]:Sept1097! | Country = US | Plan = Standard | Ads = True | Billing = November 5, 2023 | Payment = CC | Phone = (704) 975-6006 [email protected]:Silver666 | Country = GB | Plan = Standard | Billing = June 5, 2023 | Payment = VIRGIN_MEDIA_BILLED | Partner = Virgin Media [email protected]:Rascal01! | Country = US | Plan = Standard | Ads = True | Billing = November 4, 2023 | Payment = CC | Phone = (678) 468-4469 [email protected]:Codered1009! | Country = US | Plan = Premium | Billing = October 28, 2023 | Payment = CC | Phone = (720) 218-4321 [email protected]:Vanessa1 | Country = US | Plan = Standard | Ads = True | Billing = November 8, 2023 | Payment = CC | Phone = (832) 908-8563 [email protected]:march271998 | Country = US | Plan = Standard | Ads = True | Billing = October 25, 2023 | Payment = CC | Phone = (347) 219-4925 [email protected]:Serenity@3695 | Country = US | Plan = Standard | Ads = True | Billing = November 20, 2023 | Payment = CC | Phone = (347) 339-6249 [email protected]:Monkey33 | Country = GB | Plan = Standard | Ads = True | Billing = November 15, 2023 | Payment = PAYPAL | Phone = 07775 926166 [email protected]:6bp7affLl | Country = US | Plan = Standard | Ads = True | Billing = October 24, 2023 | Payment = CC | Phone = (402) 821-7859 [email protected]:11Stewie | Country = US | Plan = Standard | Ads = True | Billing = November 21, 2023 | Payment = CC | Phone = (703) 307-2120 [email protected]:Iwillpraisegod1! | Country = US | Plan = Standard | Billing = April 17, 2018 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (502) 445-1733 [email protected]:Godislove18! | Country = US | Plan = Standard | Billing = September 1, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:Ellabella1 | Country = GB | Plan = Standard | Billing = 28 August 2022 | Payment = SKY_UK_IE_BILLED | Partner = Sky [email protected]:Reggie666 | Country = US | Plan = Standard | Ads = True | Billing = November 9, 2023 | Payment = PAYPAL | Phone = (509) 449-0971 [email protected]:Swan54312 | Country = US | Plan = Standard | Ads = True | Billing = November 17, 2023 | Payment = CC [email protected]:Shiva2002 | Country = AU | Plan = Premium | Billing = 7 November 2023 | Payment = ITUNES | Partner = Apple | Phone = 0405 798 550 [email protected]:Peac0cks! | Country = US | Plan = Standard | Ads = True | Billing = November 5, 2023 | Payment = CC | Phone = (419) 619-0071 [email protected]:Spagetcha126! | Country = US | Plan = Standard | Billing = October 24, 2023 | Payment = CC | Phone = (408) 708-6039 [email protected]:Joelpaul4! | Country = US | Plan = Standard | Billing = October 21, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (732) 513-1156 [email protected]:Shazam?67 | Country = US | Plan = Standard | Billing = July 31, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:Suepoo001 | Country = NZ | Plan = Standard | Billing = 18 October 2019 | Payment = SPARK_INT_BILLED | Partner = Spark NZ | Phone = 021 511 446 [email protected]:Pickles04 | Country = US | Plan = Standard | Ads = True | Billing = November 3, 2023 | Payment = CC | Phone = (810) 336-1890 [email protected]:15Apr00@ | Country = US | Plan = Standard | Ads = True | Billing = November 1, 2023 | Payment = CC | Phone = (757) 956-0854 [email protected]:Bocayid82 | Country = GB | Plan = Standard | Billing = 3 May 2020 | Payment = SKY_UK_IE_BILLED | Partner = Sky | Phone = 07506 364725 [email protected]:Anime1== | Country = US | Plan = Premium | Billing = October 25, 2022 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (609) 505-3089 [email protected]:Nolove1031 | Country = US | Plan = Standard | Billing = December 27, 2021 | Payment = COMCAST_BILLED | Partner = Xfinity [email protected]:Westend77! | Country = US | Plan = Standard | Billing = August 18, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile [email protected]:Autobots01 | Country = US | Plan = Premium | Billing = June 10, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (956) 307-1864 [email protected]:Icecream4tresa | Country = US | Plan = Standard | Ads = True | Billing = November 15, 2023 | Payment = CC | Phone = (620) 899-6955 [email protected]:Daebaby101@ | Country = US | Plan = Standard | Ads = True | Billing = October 23, 2023 | Payment = CC | Phone = (702) 443-8810 [email protected]:Shaz2706 | Country = GB | Plan = Premium | Billing = 23 February 2023 | Payment = SKY_UK_IE_BILLED | Partner = Sky [email protected]:Shatanna0880 | Country = US | Plan = Standard | Ads = True | Billing = November 5, 2023 | Payment = CC | Phone = (312) 581-1628 [email protected]:Harleyjames1107 | Country = GB | Plan = Premium | Billing = 16 January 2023 | Payment = SKY_UK_IE_BILLED | Partner = Sky | Phone = 07949 185464 [email protected]:Headmojo#28 | Country = US | Plan = Standard | Billing = November 4, 2023 | Payment = TMOBILE_US_BILLED | Partner = T-Mobile | Phone = (301) 801-0240 [email protected]:Secret123 | Country = US | Plan = Standard | Ads = True | Billing = October 23, 2023 | Payment = PAYPAL | Phone = (606) 922-8091 [email protected]:Lkjkss1992 | Country = US | Plan = Standard | Billing = November 16, 2023 | Payment = CC | Phone = (951) 742-1200 [email protected]:Pc119512345 | Country = AU | Plan = Standard | Ads = True | Billing = 9 November 2023 | Payment = CC | Phone = 0400 522 803 [email protected]:troy2005 | Country = GB | Plan = Standard | Billing = 10 November 2023 | Payment = SKY_UK_IE_BILLED | Partner = Sky [email protected]:Zyandzari2! | Country = US | Plan = Standard | Ads = True | Billing = November 18, 2023 | Payment = CC | Phone = (205) 760-4636 [email protected]:swoosh779 | Country = NZ | Plan = Standard | Billing = 27 April 2023 | Payment = SPARK_INT_BILLED | Partner = Spark NZ [email protected]:Tonda79$ | Country = US | Plan = Standard | Ads = True | Billing = November 17, 2023 | Payment = CC | Phone = (219) 344-8579 EOD; $lines = explode("\n", $data); $formatCountry = '/Country\s*[:=]\s*([A-Z]+)/'; $formatPhoneNumber = '/Phone\s*[:=]\s*([\d\s()+-]+)/'; $formatPlan = '/\bPlan\s*[:=]\s*([^\|]+)/'; $standards = ""; $premiums = ""; foreach ($lines as $line) { $emailPasswordSegments = explode(' | ', $line); $emailPassword = explode(':', $emailPasswordSegments[0]); $email = $emailPassword[0]; $password = $emailPassword[1]; $country = ""; $phone = ""; $plan = ""; if (preg_match($formatCountry, $line, $matches)) { $country = $matches[1]; } if (preg_match($formatPhoneNumber, $line, $matches)) { $phone = $matches[1]; } if (preg_match($formatPlan, $line, $matches)) { $plan = trim($matches[1]); } if($country === 'GB') { $country = 'UK'; } $result = !empty($phone) ? "$phone:$password | Country: $country \n" : "$email:$password | Country: $country \n"; if($plan === 'Standard') { $standards .= $result; } elseif ($plan === 'Premium') { $premiums .= $result; } } echo "Standards:\n" . $standards . "\n\n"; echo "Premiums:\n" . $premiums; ?>
Write, Run & Share PHP code online using OneCompiler's PHP online compiler for free. It's one of the robust, feature-rich online compilers for PHP language, running on the latest version 7. Getting started with the OneCompiler's PHP compiler is simple and pretty fast. The editor shows sample boilerplate code when you choose language as PHP
and start coding.
OneCompiler's PHP online editor supports stdin and users can give inputs to programs using the STDIN textbox under the I/O tab. Following is a sample PHP program which takes name as input and prints hello message with your name.
<?php
fscanf(STDIN, "%s\n", $name);
echo "Hello ".$name.".\n";
?>
PHP(Hypertext Preprocessor) is widely used server sripting language by Rasmus Lerdorf in the year 1994.
In PHP, there is no need to explicitly declare variables to reserve memory space. When you assign a value to a variable, declaration happens automatically. Variables are case-sensitive in PHP.
$variable_name = value;
If, If-else, Nested-Ifs are used when you want to perform a certain set of operations based on conditional expressions.
if(conditional-expression){
//code
}
if(conditional-expression){
//code if condition is true
} else {
//code if condition is false
}
if(condition-expression1) {
//code if above condition is true
} elseif(condition-expression2){
//code if above condition is true
}
elseif(condition-expression3) {
//code if above condition is true
}
...
else {
//code if all the conditions are false
}
Switch is used to execute one set of statement from multiple conditions.
switch(conditional-expression) {
case value1:
// code if the above value is matched
break; // optional
case value2:
// code if the above value is matched
break; // optional
...
default:
// code to be executed when all the above cases are not matched;
}
For loop is used to iterate a set of statements based on a condition.
for(Initialization; Condition; Increment/decrement){
// code
}
// you can use any of the below syntax
foreach ($array as $element-value) {
//code
}
foreach ($array as $key => $element-value) {
//code
}
While is also used to iterate a set of statements based on a condition. Usually while is preferred when number of iterations are not known in advance.
while(condition) {
// code
}
Do-while is also used to iterate a set of statements based on a condition. It is mostly used when you need to execute the statements atleast once.
do {
// code
} while (condition);
Function is a sub-routine which contains set of statements. Usually functions are written when multiple calls are required to same set of statements which increases re-usuability and modularity.
function function_name(parameters) {
//code
}
function_name (parameters)