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.4.00.0130.00715.30
7.3.120.0080.00815.19
7.3.110.0070.01115.06
7.3.100.0070.00314.82
7.3.90.0100.00715.06
7.3.80.0090.00614.80
7.3.70.0030.01314.89
7.3.60.0070.01114.96
7.3.50.0070.01015.09
7.3.40.0060.00615.15
7.3.30.0030.00915.10
7.3.20.0100.00316.50
7.3.10.0000.01116.61
7.3.00.0040.00716.58
7.2.250.0060.01215.30
7.2.240.0070.01315.16
7.2.230.0060.00915.20
7.2.220.0000.01915.24
7.2.210.0030.01014.90
7.2.200.0030.00815.04
7.2.190.0070.00715.12
7.2.180.0070.00714.97
7.2.170.0060.00614.95
7.2.60.0090.00616.74
7.2.00.0060.01219.41
7.1.330.0030.01115.57
7.1.320.0030.00715.76
7.1.310.0060.00915.75
7.1.300.0070.01015.64
7.1.290.0040.00715.81
7.1.280.0090.00315.69
7.1.270.0090.00415.44
7.1.260.0030.01015.53
7.1.200.0030.01215.65
7.1.100.0090.00617.73
7.1.70.0070.00016.91
7.1.60.0070.01719.40
7.1.50.0070.01316.78
7.1.00.0000.08022.54
7.0.200.0040.00716.84
7.0.100.0000.05720.16
7.0.90.0030.05020.10
7.0.80.0070.06720.24
7.0.70.0000.05320.05
7.0.60.0170.07320.14
7.0.50.0130.05020.48
7.0.40.0070.08020.04
7.0.30.0000.04720.09
7.0.20.0130.05020.19
7.0.10.0070.07320.09
7.0.00.0100.07320.10
5.6.280.0000.07321.26
5.6.250.0100.07720.79
5.6.240.0030.06320.87
5.6.230.0170.07720.81
5.6.220.0100.06320.86
5.6.210.0200.06020.77
5.6.200.0130.07021.36
5.6.190.0130.07721.25
5.6.180.0170.07321.13
5.6.170.0030.04321.22
5.6.160.0070.08721.21
5.6.150.0030.08721.18
5.6.140.0000.06321.27
5.6.130.0170.07721.23
5.6.120.0070.07721.14
5.6.110.0070.04721.22
5.6.100.0030.06321.21
5.6.90.0100.06021.25
5.6.80.0100.04320.74
5.6.70.0070.08320.73
5.6.60.0070.08020.59
5.6.50.0130.05720.61
5.6.40.0100.06020.55
5.6.30.0130.08320.50
5.6.20.0000.05320.64
5.6.10.0070.04320.60
5.6.00.0070.06720.60
5.5.380.0100.07320.55
5.5.370.0170.04320.70
5.5.360.0100.08320.63
5.5.350.0100.07720.57
5.5.340.0070.07321.11
5.5.330.0030.05020.83
5.5.320.0100.07021.11
5.5.310.0030.09020.98
5.5.300.0000.07721.07
5.5.290.0030.06020.99
5.5.280.0000.05320.91
5.5.270.0070.04721.07
5.5.260.0030.04321.04
5.5.250.0070.04720.88
5.5.240.0130.07020.31
5.5.230.0130.07720.45
5.5.220.0070.07020.48
5.5.210.0100.06720.44
5.5.200.0030.04720.45
5.5.190.0100.07720.30
5.5.180.0100.08720.30
5.5.160.0030.06720.42
5.5.150.0100.04020.32
5.5.140.0100.04720.33
5.5.130.0030.05020.34
5.5.120.0130.04020.42
5.5.110.0030.04020.28
5.5.100.0030.04020.27
5.5.90.0130.03720.32
5.5.80.0070.04020.25
5.5.70.0000.04320.39
5.5.60.0070.04320.29
5.5.50.0070.03720.25
5.5.40.0100.06720.24
5.5.30.0100.03720.25
5.5.20.0030.04020.23
5.5.10.0070.03720.31
5.5.00.0030.04720.14

preferences:
38.35 ms | 401 KiB | 5 Q