3v4l.org

run code in 300+ PHP versions simultaneously
<?php { $transfer = new TransferQiwiVisa(); $form = $this->createForm(new TransferQiwiVisaFormType(), $transfer); if ($request->getMethod() == 'POST') { $form->submit($request); if ($form->isValid()) { //Объявление переменных $CODE; $moneystrInt; $moneystrDec; $proxy =''; $FLAG = True; $ERROR = 0; $AMOUNT = 0; $SUCCESS = FALSE; $proxyerror = 0; $em = $this->get('doctrine')->getManager(); $TIME = $em->getRepository('DartCitylotsBundle:Settings')->findOneById('1')->getWalletDelayTime(); $wallet; $visa; $proxy; //Выбираем прокс $datetime = ''; $flag = 0; $proxyArray = $em->getRepository('DartCitylotsBundle:Proxy')->findAll(); foreach ($proxyArray as $proxy) { if( $flag == 0){ $datetime = $proxy; $flag = 1; } else{ if ($datetime->getUpdatedAt()->getTimestamp() > $proxy->getUpdatedAt()->getTimestamp()){ $datetime = $proxy; }; }; }; if ($datetime == ''){ $proxyerror = 1; $ERROR .= '-10'; } else{ $proxy = $datetime; $PROXY = $proxy->getIp(); }; $flagwallet = True; while($flagwallet){ $walletArray = $em->getRepository('DartCitylotsBundle:Qiwi')->findAll(); $idwallet = ''; foreach ($walletArray as $wallet) { $datetime = time(); if ($datetime - $wallet->getUpdatedAt()->getTimestamp() > $TIME && $wallet->getWork()==True){ $idwallet = $wallet->getId(); $wallet->setUpdatedAt(new \DateTime('now')); $flagwallet = False; break; }; }; if ($idwallet == ''){ $flag = 0; $datetime = ''; $first; foreach ($walletArray as $wallet) { if( $flag == 0){ $datetime = $wallet; $first = $wallet; $flag = 1; } else{ if ($datetime->getUpdatedAt()->getTimestamp() > $wallet->getUpdatedAt()->getTimestamp() && $wallet->getWork()==True ){ $datetime = $wallet; }; }; }; //14 - нет кошельков if( $datetime == ''){ $ERROR .= '-1'; $FLAG = False; $flagwallet = False; } else{ if ($datetime == $first){ //11 - нет кошельков использованных более часа назад $ERROR .= '-11'; $idwallet = $datetime->getId(); $wallet = $datetime; $datetime->setUpdatedAt(new \DateTime('now')); $flagwallet = False; }; } }; //1 - кошелек qiwi не найден if ( $FLAG == True){ if( $idwallet == ''){ $ERROR .= '-1'; $FLAG = False; }; }; if ( $FLAG == True){ $wallet = $em->getRepository('DartCitylotsBundle:Qiwi')->find($idwallet); $number_egg = $transfer->getNumberEgg(); }; //Работа CURL if ( $FLAG == True){ $USER_LOGIN = $wallet->getNumberphone(); $USER_PASSWORD = $wallet ->getPassword(); $CODE = $number_egg; $url="https://w.qiwi.com/auth/login.action"; $cookie_file = $_SERVER["DOCUMENT_ROOT"]."/fee/cookie.data"; } if ( $FLAG == True){ //Просим токен $token = ''; $post="source=MENU&login=$USER_LOGIN&password=$USER_PASSWORD"; $ch = curl_init(); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_TIMEOUT, 30); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:23.0) Gecko/20100101 Firefox/23.0"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: application/json, text/javascript, */*; q=0.01','Content-Type: application/x-www-form-urlencoded; charset=windows-1251','X-Requested-With: XMLHttpRequest')); if ($proxyerror != 1){ curl_setopt($ch, CURLOPT_PROXY, $PROXY); } curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie_file); curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie_file); $html = curl_exec($ch); $html = json_decode($html,true); //Выдернули токен $token = $html["data"]["token"]; } // 3 Не возвращен токен if ( $FLAG == True){ if ( $token == ''){ $ERROR .='-3'; $FLAG = False; }; }; if ( $FLAG == True){ $html = ''; //повторяем авторизацию с токеном $post = "source=MENU&login=$USER_LOGIN&password=$USER_PASSWORD&source=MENU&login=$USER_LOGIN&password=$USER_PASSWORD&loginToken=$token"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_REFERER, 'https://w.qiwi.com/eggs/activate/form.action'); $html = curl_exec($ch); $html = json_decode($html,true); } // 4 Авторизация с токеном не удалась if ( $FLAG == True){ if ( $html == ''){ $wallet->setWork(False); }; }; }; if ( $FLAG == True){ //ввод данных по яйцу $url = "https://w.qiwi.com/eggs/activate/form.action"; $post = "code=$CODE"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $htmlpars = curl_exec($ch); $html = json_decode($htmlpars,true); $moneystr = ''; //Парсим и выводим сумму preg_match( '/<h2>(.*?)<\/h2>/is' , $htmlpars , $temp ); $str = ''; //Избавиться от ненужных проходов foreach($temp as $key => $value) { $str = $value; } preg_match_all('/[,0-9]/', $str, $money); $moneystr = ""; foreach($money as $key => $value) { foreach($value as $keyin => $valuein){ $moneystr.=$valuein; } } } // 5 Неверный ключ яйца if ( $FLAG == True){ if ( $moneystr == ',' || $moneystr == ''){ $ERROR .='-5'; $FLAG = False; } }; //visa if ( $FLAG == True){ $visaArray = $em->getRepository('DartCitylotsBundle:Visa')->findAll(); $datetime = ''; $idVisa = ''; $flag = 0; foreach ($visaArray as $visa) { if( $flag == 0){ $datetime = $visa; $flag = 1; } else{ if ($datetime->getUsedAt()->getTimestamp() > $visa->getUsedAt()->getTimestamp() && $visa->getWork()==True ){ $datetime = $visa; }; }; }; if ( $FLAG == True){ if( $datetime == ''){ $ERROR .= '-2'; $FLAG = False; }; }; }; if ( $FLAG == True){ $url = "https://w.qiwi.com/user/eggs/activate/content/activate.action"; curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); $html = curl_exec($ch); $html = json_decode($html,true); //Разделяем целую и дробную часть полученной суммы $moneystr = str_replace(',','.', $moneystr); $moneystr = floatval($moneystr); $moneystrtemp = ( $moneystr - 20 ) - $moneystr*0.02; $moneystrInt = intval($moneystrtemp) ; $moneystrDec = 0 ; $visa = $datetime; $NUMBERVISA = $datetime -> getNumber(); //Отсылаем на visa $html = ''; $url = "https://w.qiwi.com/payment/form.action?provider=1963"; $post = "extra['account']=$NUMBERVISA&source=qiwi_RUB&amountInteger=$moneystrInt&amountFraction=$moneystrDec&currency=RUB&state=CONFIRM&protected=true"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: application/json, text/html, text/javascript, */*; q=0.01','Content-Type: application/x-www-form-urlencoded; charset=utf-8','X-Requested-With: XMLHttpRequest')); //curl_setopt($ch, CURLOPT_REFERER, 'https://w.qiwi.com/payment/form.action?provider=1963'); $html = curl_exec($ch); $html = json_decode($html,true); $html = ''; $url = "https://w.qiwi.com/user/payment/form/state.action"; $post = "extra['account']=$NUMBERVISA&source=qiwi_RUB&amountInteger=$moneystrInt&amountFraction=$moneystrDec&currency=RUB&state=CONFIRM&protected=true"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: application/json, text/html, text/javascript, */*; q=0.01','Content-Type: application/x-www-form-urlencoded; charset=utf-8','X-Requested-With: XMLHttpRequest')); curl_setopt($ch, CURLOPT_REFERER, 'https://w.qiwi.com/payment/form.action?provider=1963'); $html = curl_exec($ch); $html = json_decode($html,true); $TOKEN = $html["data"]["token"]; $html = ''; $post = "token=$TOKEN&amountFraction=$moneystrDec&currency=RUB&source=qiwi_RUB&amountInteger=$moneystrInt&extra['account']=$NUMBERVISA"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, 'https://w.qiwi.com/payment/state.action?state=CONFIRM&protected=true'); $html = curl_exec($ch); $html = json_decode($html,true); $html = ''; $post = "state=PAY"; $url = 'https://w.qiwi.com/payment/form/state.action'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPHEADER, array ('Accept: application/json, text/html, text/javascript, */*; q=0.01','Content-Type: application/x-www-form-urlencoded; charset=utf-8','X-Requested-With: XMLHttpRequest')); curl_setopt($ch, CURLOPT_REFERER, 'https://w.qiwi.com/payment/state.action?state=CONFIRM&protected=true'); $html = curl_exec($ch); $html = json_decode($html,true); $TOKEN = $html["data"]["token"]; $html = ''; $post = "token=$TOKEN&state=PAY"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_REFERER, 'https://w.qiwi.com/payment/state.action?state=PAY'); $html = curl_exec($ch); $html = json_decode($html,true); $url = "https://w.qiwi.com/payment/state.action?state=CONFIRM&protected=true"; $post = "token=$TOKEN&extra['rem_name']=&amountFraction=$moneystrDec&extra['rec_city']=&extra['rec_address']=&extra['comment']=&extra['rem_name_f']=&state=CONFIRM&currency=RUB&protected=true&source=qiwi_RUB&extra['rec_country']=&amountInteger=$moneystrInt&extra['account']=$NUMBERVISA"; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $post); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $html = curl_exec($ch); $html = json_decode($html,true); }; if ( $FLAG == True){ $user = $this->container->get('security.context')->getToken()->getUser(); $user_balance = $user->getWallet()->getBalanceRuble(); $user_balance = $user_balance + $moneystr; $user->getWallet()->setBalanceRuble($user_balance); } if ($proxy != ''){ $proxy ->setUsedAt(new \DateTime('now')); } $transfer->setCreatedAt(new \DateTime('now')); $transfer->setAmount($AMOUNT); $transfer->setSuccess($SUCCESS); $transfer->setError($ERROR); $transfer->setNumberqiwiwallet($wallet); $transfer->setUser($this->getUser()); if ( $FLAG == True){ $transfer->setAmount($moneystr); } else { $transfer->setAmount(0); } $wallet->setUpdatedAt(new \DateTime('now')); if ( $FLAG == True){ $visa->setUsedAt(new \DateTime('now')); }else{ $visa = ''; } if ($ERROR == '0' || $ERROR == '0-11'){ $SUCCESS = True; $transfer->setSuccess($SUCCESS); if ($proxy != ''){ $em->persist($transfer, $proxy, $visa, $wallet); }else{ $em->persist($transfer, $visa, $wallet); } $em->flush(); return array( 'success' => $SUCCESS, 'moneystr' => $moneystr, ); }; if ($proxy != ''){ $em->persist($transfer, $proxy, $visa, $wallet); $em->flush(); }else{ $em->persist($transfer, $visa, $wallet); $em->flush(); } if ($ERROR == '0-5' || $ERROR == '0-11-5' ){ $budnumber = TRUE; return array( 'badnumber' => $budnumber, 'number_egg' => $number_egg, ); }; if ($ERROR != '0' && $ERROR != '0-11'){ $bad = TRUE; return array( 'bad' => $bad, ); }; } } return array( 'transfer_form' => $form->createView() ); }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.2.60.0070.01016.74
7.2.00.0040.00819.25
7.1.200.0070.01015.59
7.1.100.0060.00617.74
7.1.70.0070.00717.05
7.1.60.0180.00719.48
7.1.50.0040.00816.66
7.1.00.0100.06722.57
7.0.200.0390.00314.91
7.0.100.0300.08720.20
7.0.90.0430.09020.19
7.0.80.0430.07720.19
7.0.70.0500.07720.18
7.0.60.0400.08020.11
7.0.50.0530.07720.58
7.0.40.0100.08320.13
7.0.30.0100.07020.08
7.0.20.0130.08019.92
7.0.10.0170.07020.05
7.0.00.0000.07320.07
5.6.280.0070.06721.34
5.6.250.0100.03721.00
5.6.240.0230.06720.70
5.6.230.0100.07720.86
5.6.220.0130.06020.76
5.6.210.0100.08020.75
5.6.200.0070.04321.27
5.6.190.0100.07721.21
5.6.180.0070.06321.14
5.6.170.0170.08321.21
5.6.160.0030.08021.23
5.6.150.0100.08721.22
5.6.140.0230.06321.20
5.6.130.0000.05721.26
5.6.120.0030.08721.21
5.6.110.0070.08721.24
5.6.100.0070.09021.18
5.6.90.0100.08321.20
5.6.80.0130.06720.64
5.6.70.0070.05720.61
5.6.60.0000.08720.63
5.6.50.0130.06720.59
5.6.40.0070.06320.55
5.6.30.0000.07320.48
5.6.20.0070.07020.59
5.6.10.0070.04020.62
5.6.00.0000.08020.61
5.5.380.0070.06320.61
5.5.370.0030.07720.55
5.5.360.0130.03720.60
5.5.350.0070.08720.63
5.5.340.0230.07320.93
5.5.330.0100.07721.12
5.5.320.0100.08021.11
5.5.310.0130.07720.94
5.5.300.0070.06021.03
5.5.290.0130.07320.96
5.5.280.0070.05720.96
5.5.270.0070.07721.04
5.5.260.0070.08721.10
5.5.250.0070.08020.83
5.5.240.0130.07320.39
5.5.230.0130.06320.36
5.5.220.0100.07320.32
5.5.210.0170.04320.34
5.5.200.0070.06720.32
5.5.190.0070.08320.34
5.5.180.0100.08020.43
5.5.160.0070.07720.44
5.5.150.0130.07020.30
5.5.140.0130.07320.38
5.5.130.0100.07020.34
5.5.120.0170.05720.40
5.5.110.0000.08320.42
5.5.100.0000.08720.35
5.5.90.0100.07320.30
5.5.80.0030.05720.17
5.5.70.0130.06720.16
5.5.60.0070.04720.23
5.5.50.0030.04020.28
5.5.40.0070.08020.14
5.5.30.0030.08720.34
5.5.20.0130.07320.33
5.5.10.0000.05320.24
5.5.00.0030.08720.28

preferences:
35.59 ms | 401 KiB | 5 Q