3v4l.org

run code in 300+ PHP versions simultaneously
<?php # Ловим исключения : try { # Обработка POST - запросов : switch( getField( $_POST, 'sMod' ) ) { # Добавление Qiwi.кошелька : case 'addQiwiAccount': # Получение внешних данных : $iAccount = getField( $_POST, 'iAccount', 'int' ); $sPassword = getField( $_POST, 'sPassword' ); # Подключение к кошельку : $oQiwi = new Qiwi( $iAccount, $sPassword ); # Очистка файла cookie : $oQiwi->clearCookie(); # Добавление данных в базу : Shop::dbQiwiAccounts()->create( array( 'iAccount' => $iAccount, 'sPassword' => $sPassword ) ); # Debug : jsAlert( 'Qiwi.кошелек +'.$iAccount.' успешно добавлен!' ); break; # Сохранение Qiwi.кошелька : case 'saveQiwiAccount': # Получение внешних данных : $iID = getField( $_POST, 'iID', 'int' ); $iAccount = getField( $_POST, 'iAccount', 'int' ); $sPassword = getField( $_POST, 'sPassword' ); if( ($iRedirectAccount = getField( $_POST, 'iRedirectAccount', 'int' )) <= 0 ) $iRedirectAccount = null; if( ($dRedirectAmount = getField( $_POST, 'dRedirectAmount', 'money' )) < 0.01 ) $dRedirectAmount = null; # Подключение к кошельку : $oQiwi = new Qiwi( $iAccount, $sPassword ); # Очистка файла cookie : $oQiwi->clearCookie(); # Сохранение данных в базе : Shop::dbQiwiAccounts()->edit( array( 'iID' => $iID ), array( 'iAccount' => $iAccount, 'sPassword' => $sPassword, 'iRedirectAccount' => $iRedirectAccount, 'dRedirectAmount' => $dRedirectAmount ) ); # Debug : jsAlert( 'Данные Qiwi.кошелька +'.$iAccount.' успешно сохранены!' ); break; # Удаление Qiwi.кошелька : case 'deleteQiwiAccount': # Получение внешних данных : $iID = getField( $_POST, 'iID', 'integer' ); $iAccount = getField( $_POST, 'iAccount', 'int' ); # Удаление данных из базы : Shop::dbQiwiAccounts()->delete( array( 'iID' => $iID ) ); # Удаление заказов с этим кошельком : Shop::dbOrders()->delete( array( 'iQiwiAccount' => $iAccount ) ); # Debug : jsAlert( 'Qiwi.кошелек +'.$iAccount.' успешно удален!' ); break; } } catch( Exception $e ) { # Debug : jsAlert( 'Ошибка: '.$e->getMessage().'!' ); } # Подключаем список кошельков к шаблону : Smarty()->assign( 'aQiwiAccounts', Shop::dbQiwiAccounts()->searchAll( '', 'm.*', 'iTurnover', 'asc' ), true );
Output for 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
Fatal error: Uncaught Error: Call to undefined function getField() in /in/rDvXl:6 Stack trace: #0 {main} thrown in /in/rDvXl on line 6
Process exited with code 255.
Output for 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Fatal error: Call to undefined function getField() in /in/rDvXl on line 6
Process exited with code 255.

preferences:
248.39 ms | 402 KiB | 375 Q