Toolbox for developers / PHP online test

PHP syntax checker

PHP tester allows to check your PHP code syntax, and find PHP errors easily and quickly. This PHP code checker tool highlights and goes to line with a syntax error.

To check your code, you must copy and paste, drag and drop a PHP file or directly type in the "PHP code" online editor below, and click on "Check PHP syntax" button.

You can see the user guide to help you to use this php checker tool.


PHP code




PHP version for code checker



User guide

To check syntax code:

  • First, Drag and drop your PHP file or copy / paste your PHP text directly into the editor above.
  • Finally, you must click on "Check PHP syntax" button to display if there is an syntax error in your code.


PHP code checker tool

PHP is a server-side scripting language, but can also be used as a general-purpose programming language.

PHP error checker tool allows to find syntax errors (lint). You can test your PHP code online directly in your browser.

If a syntax error is detected, then the line in error is highlighted, and it jumps to it to save time (no need to search the line).

It can be useful to make online test to save time (deployment ...).

Note: This tool no longer offers sandbox, it was not good enough.


About PHP

PHP (recursive acronym for PHP: Hypertext Preprocessor) is a server-side scripting language especially suited for web development.PHP script can be embedded into HTML. PHP can also be used as a general-purpose programming language.

PHP has become popular among Web Developers thanks to its advantages: Simplicity, Free, Flexible and Scalable, CMS, Vast Community ...



You can report a bug or give feedback by adding a comment (below) or by clicking "Contact me" link (at the top right hand corner of the page).

Comments




shivanee-2019-09-04 18:45
my site is error checking now


Anonymous-2019-12-13 10:13
<?php get_header();?>

<div class = "blog1">
<div class="breadcrumb">
<?php get_breadcrumb(); ?>
</div>
</div>
<!--===========================while-loop-start======================================-->
<?php
$query = new WP_Query( array( 'post_type' => 'post' , 'order' => 'ASC', 'posts_per_page' => 1) );?>

<?php while ($query->have_posts() ) : $query->the_post();?>
<article id="post-<?php the_ID(); ?>" <?php post_class( ); ?>>
<div class = "container">
<div class = "row">
<div class = "col-md-12">
<div class="post-container">
<div class = "postimage11">
<?php the_post_thumbnail(); ?>
</div>

<div class="entry-header1">
<h1 class="entry-title"><a href="<?php echo get_permalink( $post->ID)?>"><?php the_title(); ?></h1>
</div>
<div class="categories1"><?php echo the_category('');?>
<hr>
</div>
<?php get_the_date( " ", null );?>

<div class="date1">
<a href="<?php echo get_day_link( $archive_year, $archive_month, $archive_day); ?>"><?php echo get_the_date('M/d/y'); ?></a>
</div>
<?php $categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
) );?>

<div class="author11">
<div class = "aut1">
<p>by</p>
</div>
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>"><?php the_author(); ?></a>
</div>

<div class = "content11">
<?php echo the_content();?>
</div>
</div>
</div>
</div>
</div>
</article>
<?php
echo get_sidebar('right');?>
<?php
endwhile;?>
<?php
wp_reset_postdata();?>
<!--=================================while-loop-second=================================-->
<?php
$query1 = new WP_Query( array( 'post_type' => 'post' , 'order' => 'ASC', 'offset' => 1) );?>

<?php while ($query1->have_posts() ) : $query1->the_post();?>
<article id="post-<?php the_ID(); ?>" <?php post_class( ); ?>>
<div class = "sec">
<div class = "row">
<div class = "col-md-6">

<div class="post-container">
<div class = "postimage">
<?php the_post_thumbnail(); ?>
</div>

<div class="entry-header">
<h1 class="entry-title"><a href="<?php echo get_permalink( $post->ID)?>"><?php the_title(); ?></h1>
</div>
<div class="categories"><?php echo the_category('');?>
<hr>
</div>
<?php get_the_date( " ", null );?>

<div class="date">
<a href="<?php echo get_day_link( $archive_year, $archive_month, $archive_day); ?>"><?php echo get_the_date('M/d/y'); ?></a>
</div>
<?php $categories = get_categories( array(
'orderby' => 'name',
'order' => 'ASC'
) );?>

<div class="author1">
<div class = "aut">
<p>by</p>
</div>
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" title="<?php echo esc_attr( get_the_author() ); ?>"><?php the_author(); ?></a>
</div>
</div>
</div>
</div>
</div>
</article>
<?php
endwhile;?>

<?php get_footer(); ?>





sima-2019-12-31 08:06


sima-2019-12-31 08:06
my code


sima-2019-12-31 08:07
<?php include "../../includes/header.php"; ?><br/><link href="../../public/css/login.css" rel="stylesheet"><br/><br/><!--Main Layout--><br/><!--Intro Section--><br/><section class="view intro-2"><br/> <div class="mask rgba-stylish-strong h-100 justify-content-center align-items-center"><br/> <div class="container"><br/> <div class="row"><br/> <div class="col-xl-5 col-lg-6 col-md-10 col-sm-12 mx-auto mt-lg-5"><br/><br/> <!--Form with header--><br/> <div class="mt-5 card wow fadeIn" data-wow-delay="0.4s"><br/> <div class="card-body"><br/> <form action="#" class="login" id="login"><br/> <input type="hidden" name="type" value="login"><br/> <!--Header--><br/> <div class="form-header blue-gradient"><br/> <h3><i class="fa fa-user mt-2 mb-2"></i> Log in:</h3><br/> </div><br/> <!--Body--><br/> <div class="md-form"><br/> <i class="fa fa-user prefix white-text"></i><br/> <input name="email" type="text" id="orangeForm-name" class="form-control"><br/> <label for="orangeForm-name">Email</label><br/> </div><br/><br/> <div class="md-form"><br/> <i class="fa fa-lock prefix white-text"></i><br/> <input name="password" type="password" id="orangeForm-pass" class="form-control"><br/> <label for="orangeForm-pass">Your password</label><br/> </div><br/><br/> <div class="text-center"><br/> <button onclick="submitForm()" class="btn blue-gradient btn-lg">Sign In</button><br/> <hr><br/> <p class="text-white">&copy; 2019 Copyright:<br/> </div><br/> </form><br/> </div><br/> </div><br/> <!--/Form with header--><br/><br/> </div><br/> </div><br/> </div><br/> </div><br/></section><br/><!--Main Layout--><br/><br/><?php include "../../includes/footer.php"; ?><br/><br/><br/><br/><script><br/> function submitForm(e) {<br/> event.preventDefault();<br/> var loginInfo = $('.login').serialize();<br/> $.ajax({<br/> type: 'POST',<br/> url: '../../includes/users/UsersController.php',<br/> data: loginInfo,<br/> beforeSend: function() {<br/> Swal.fire({<br/> title: "Logging You In",<br/> type: "info",<br/> timer: 10000,<br/> onBeforeOpen: () => {<br/> Swal.showLoading()<br/> timerInterval = setInterval(() => {}, 100)<br/> }<br/> });<br/> },<br/> success: function(resp) {<br/> if (!resp="" && !resp == "success") {<br/> window.location.href = "../admin/admin.php";<br/> } else if (resp == "manager") {<br/> window.location.href = "user.php";<br/> } else {<br/> Swal.fire({<br/> title: resp,<br/> type: "error",<br/><br/><br/> });<br/> }<br/> },<br/><br/> })<br/> }<br/> alert ('hello')<br/></script><br/>


Дмитрий-2019-12-31 10:31
<?php<br/>/*<br/> * @Автор SeoLik.ru<br/> * @Читать статью https://seolik.ru/p/autentifikaciya-na-sayte-cherez-vkontakte<br/> */<br/><br/> # Старт сессии<br/>@session_start();<br/><br/># Старт буфера<br/>@ob_start();<br/><br/># Автоподгрузка классов<br/>function __autoload($name){ include("../classes/_class.".$name.".php");}<br/><br/># Класс конфига<br/>$config = new config;<br/># Функции<br/>$func = new func;<br/>$block = new block_login();<br/># База данных<br/>$db = new db($config->HostDB, $config->UserDB, $config->PassDB, $config->BaseDB);<br/><br/>if(isset($_SESSION["user_id"])){ header("Location: /account/"); return; }<br/><br/>$client_id = '7265343'; // ID приложения<br/>$client_secret = 'Ym0Q4itjQO0Po710Lm4H'; // Защищённый ключ<br/>$redirect_uri = 'http://cc91571.tmweb.ru/social_login_callback/vk.php'; // Доверенный redirect URI<br/><br/>if (isset($_GET['code'])) {<br/>$result = false;<br/>$params = array(<br/> 'client_id' => $client_id,<br/> 'client_secret' => $client_secret,<br/> 'code' => $_GET['code'],<br/> 'redirect_uri' => $redirect_uri,<br/> );<br/><br/> $token = json_decode(file_get_contents('https://oauth.vk.com/access_token' . '?' . urldecode(http_build_query($params))), true);<br/><br/> if (isset($token['access_token'])) {<br/> $params = array(<br/> 'uids' => $token['user_id'],<br/> 'fields' => 'uid,first_name,last_name,screen_name,sex,bdate,photo_big',<br/> 'access_token' => $token['access_token'],<br/> 'v' => '5.71',<br/> );<br/><br/> $userInfo = json_decode(file_get_contents('https://api.vk.com/method/users.get' . '?' . urldecode(http_build_query($params))), true);<br/> <br/> $email = $token['email']; // получение email юзера<br/> <br/> <br/> if (isset($userInfo['response'][0]['uid'])) {<br/> $userInfo = $userInfo['response'][0];<br/> $result = true;<br/> }<br/> }<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/>$chars="qazxswedcvfrtgbnhyujmkiolp1234567890QAZXSWEDCVFRTGBNHYUJMKIOLP"; <br/> $max=20; <br/> $size=StrLen($chars)-1; <br/> $paypass = null; <br/> while($max--) <br/> $paypass .= $chars[rand(0,$size)];<br/> <br/> <br/> $pass = $func->IsPassword($_POST["pass"]);<br/> $rules = isset($_POST["rules"]) ? true : false;<br/> $time = time();<br/> $ip = $func->UserIP;<br/> $ipregs = $db->Query("SELECT * FROM `db_users_a` WHERE INET_NTOA(db_users_a.ip) = '$ip' ");<br/> $ipregs = $db->NumRows();<br/><br/> <br/> $login1 = filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING);<br/> <br/> <br/> $login = "User".$token['user_id'];<br/> $passwordBase = $func->md5Password($paypass);<br/> <br/> <br/> <br/> $optionsLogin = array(<br/> 'options' => array(<br/> 'regexp' => '/^[a-zA-Z0-9]{5,20}$/'<br/> ) <br/> );<br/> $login = filter_var($login, FILTER_VALIDATE_REGEXP, $optionsLogin);<br/> $referer_id = (isset($_COOKIE["i"]) AND intval($_COOKIE["i"]) > 0 AND intval($_COOKIE["i"]) < 1000000) ? intval($_COOKIE["i"]) : 1;<br/> <br/> <br/><br/> <br/><br/> # Узнаем реферера<br/> if($referer_id != 1){<br/><br/> $db->Query("SELECT `user`,`id` FROM `db_users_a` WHERE id = '$referer_id' LIMIT 1");<br/><br/> if($db->NumRows() > 0){<br/><br/> #$referer_name = $db->FetchRow();<br/> $data_t = $db->FetchArray();<br/><br/> $referer_id = $data_t["id"];<br/> $referer_name = $data_t["user"];<br/><br/> }else{ $referer_id = 1; $referer_name = "Admin"; }<br/><br/> }else{ $referer_id = 1; $referer_name = "Admin"; }<br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/><br/><br/><br/><br/><br/> <br/> <br/> <br/> <br/> <br/> <br/><br/> <br/> <br/> <br/> <br/> <br/> $db->Query("SELECT COUNT(*) FROM db_users_a WHERE user = '$login'");<br/> if($db->FetchRow() == 0){ <br/> $db->Query("SELECT COUNT(*) FROM db_users_a WHERE email = '$email'");<br/> if($db->FetchRow() == 0){ <br/> <br/> # Регаем пользователя<br/>/* ================== */<br/> $db->Query("SELECT referer, referer_id FROM db_users_a WHERE id = '$referer_id' LIMIT 1");<br/> $stats_data = $db->FetchArray();<br/> $referer_name2 = $stats_data["referer"];<br/> $referer_id2 = $stats_data["referer_id"];<br/> <br/> $db->Query("SELECT referer, referer_id FROM db_users_a WHERE id = '$referer_id2' LIMIT 1");<br/> $stats_data3 = $db->FetchArray();<br/> $referer_name3 = $stats_data3["referer"];<br/> $referer_id3 = $stats_data3["referer_id"];<br/><br/> <br/><br/> $lid = $db->LastInsert();<br/> # Регаем пользователя<br/> $db->Query("INSERT INTO db_users_a (user, email, pass, referer, referer_id, referer_id2, referer_id3, date_reg, ip)<br/> VALUES ('$login','{$email}','$passwordBase','$referer_name','$referer_id','$referer_id2','$referer_id3', '$time',INET_ATON('$ip'))");<br/> /* ================== */ <br/> $db->Query("INSERT INTO db_users_b (id, user, last_sbor) VALUES ('$lid','$login','$time')");<br/> <br/> $db->Query("INSERT INTO `db_users_data` (id,`user_login`,`user_name`,`payeer`,`qiwi`,`yandex`) VALUES ('$lid','$login','$login','0','0','0')");<br/> # Вставляем статистику<br/> $db->Query("SELECT COUNT(*) FROM db_users_a WHERE referer_id = '$referer_id'");<br/> $refs = $db->FetchRow();<br/> $db->Query("UPDATE db_users_a SET referals = '$refs' WHERE id = '$referer_id'");<br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/>$db->Query("UPDATE db_users_a SET referals = referals + 1 WHERE id = '$referer_id'");<br/> <br/> header('Refresh: 1; URL=/login/');<br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> }else{<br/> <br/>echo "11111";<br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/>$login = "User".$token['user_id'];<br/>$optionsLogin = array(<br/> 'options' => array(<br/> 'regexp' => '/^[a-zA-Z0-9]{5,20}/'<br/> ) <br/>);<br/>$username = filter_var($login, FILTER_VALIDATE_REGEXP, $optionsLogin);<br/>if($username !== false){<br/>if ($block->checkAuth($username)){<br/>$db->Query("SELECT id, user, pass, referer_id, banned, pri4ina_banned FROM db_users_a WHERE user = '$username'");<br/> if($db->NumRows() == 1){<br/>$log_data = $db->FetchArray();<br/>$post_pass = $func->md5Password($_POST["pass"]);<br/><br/>if($log_data["banned"] == 0){<br/>if ($block->checkBlockIp()) {<br/><br/>$recaptcha = '1';<br/> # Считаем рефералов<br/>$db->Query("SELECT COUNT(*) FROM db_users_a WHERE referer_id = '".$log_data["id"]."'");<br/>$refs = $db->FetchRow();<br/>$user_agent = hash('sha256', $func->UserAgent() );<br/>$db->Query("UPDATE db_users_a SET referals = '$refs', date_login = '".time()."', ip = INET_ATON('".$func->UserIP."'), browser = '$user_agent' WHERE id = '".$log_data["id"]."'");<br/>$_SESSION["user_id"] = $log_data["id"];<br/>$_SESSION["user"] = $log_data["user"];<br/>$_SESSION["referer_id"] = $log_data["referer_id"];<br/>### МУЛЬТИКИ ### <br/>$Multi->CheckCookiesLogin($username); <br/>################<br/>if (!$block->checkBlock($username)) {<br/># Обнулим NUM если в базе есть<br/>$block->updateNum($username);<br/>}<br/><br/>header('Refresh: 1; URL=/');<br/><br/>}else{<br/># Считаем рефералов<br/>$db->Query("SELECT COUNT(*) FROM db_users_a WHERE referer_id = '".$log_data["id"]."'");<br/>$refs = $db->FetchRow();<br/>$user_agent = hash('sha256', $func->UserAgent() );<br/>$db->Query("UPDATE db_users_a SET referals = '$refs', date_login = '".time()."', ip = INET_ATON('".$func->UserIP."'), browser = '$user_agent' WHERE id = '".$log_data["id"]."'");<br/>$_SESSION["user_id"] = $log_data["id"];<br/>$_SESSION["user"] = $log_data["user"];<br/>$_SESSION["referer_id"] = $log_data["referer_id"];<br/><br/>### МУЛЬТИКИ ### <br/>$Multi->CheckCookiesLogin($username); <br/>################<br/><br/>if (!$block->checkBlock($username)) {<br/># Обнулим NUM если в базе есть<br/>$block->updateNum($username);<br/>}<br/><br/>header('Refresh: 1; URL=/account/');<br/>} # END проверка в базе<br/><br/>}else{<br/>$pri4ina_banned = $log_data["pri4ina_banned"];<br/>$text_banned = 'Аккаунт заблокирован';<br/>echo $text_banned;<br/>}<br/>}else{<br/><br/> if ($block->updateBlock($username) == NULL) {<br/> echo $func->error("Логин не зарегистрирован");<br/> }else echo $block->updateBlock($username);<br/><br/> # запишем в базу при ошибке<br/> $block->rcGoogleBase();<br/> }<br/><br/> }else{<br/> echo $block->updateBlock($username);#echo $func->error("Попробуйте позже!", true);<br/> # запишем в базу при ошибке<br/> $block->rcGoogleBase();<br/> } <br/><br/> }else{<br/><br/> if ($block->updateBlock($username) == NULL) {<br/> echo $func->error("Логин указан неверно!");<br/> }else echo $block->updateBlock($username);<br/><br/> # запишем в базу при ошибке<br/> $block->rcGoogleBase();<br/><br/> } <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> <br/> }<br/> }else{<br/> <br/>echo "22222";<br/><br/>$login = "User".$token['user_id'];<br/>$optionsLogin = array(<br/> 'options' => array(<br/> 'regexp' => '/^[a-zA-Z0-9]{5,20}/'<br/> ) <br/>);<br/>$username = filter_var($login, FILTER_VALIDATE_REGEXP, $optionsLogin);<br/>if($username !== false){<br/>if ($block->checkAuth($username)){<br/>$db->Query("SELECT id, user, pass, referer_id, banned, pri4ina_banned FROM db_users_a WHERE user = '$username'");<br/> if($db->NumRows() == 1){<br/>$log_data = $db->FetchArray();<br/>$post_pass = $func->md5Password($_POST["pass"]);<br/><br/>if($log_data["banned"] == 0){<br/>if ($block->checkBlockIp()) {<br/><br/>$recaptcha = '1';<br/> # Считаем рефералов<br/>$db->Query("SELECT COUNT(*) FROM db_users_a WHERE referer_id = '".$log_data["id"]."'");<br/>$refs = $db->FetchRow();<br/>$user_agent = hash('sha256', $func->UserAgent() );<br/>$db->Query("UPDATE db_users_a SET referals = '$refs', date_login = '".time()."', ip = INET_ATON('".$func->UserIP."'), browser = '$user_agent' WHERE id = '".$log_data["id"]."'");<br/>$_SESSION["user_id"] = $log_data["id"];<br/>$_SESSION["user"] = $log_data["user"];<br/>$_SESSION["referer_id"] = $log_data["referer_id"];<br/>### МУЛЬТИКИ ### <br/>$Multi->CheckCookiesLogin($username); <br/>################<br/>if (!$block->checkBlock($username)) {<br/># Обнулим NUM если в базе есть<br/>$block->updateNum($username);<br/>}<br/><br/>header('Refresh: 1; URL=/');<br/><br/>}else{<br/># Считаем рефералов<br/>$db->Query("SELECT COUNT(*) FROM db_users_a WHERE referer_id = '".$log_data["id"]."'");<br/>$refs = $db->FetchRow();<br/>$user_agent = hash('sha256', $func->UserAgent() );<br/>$db->Query("UPDATE db_users_a SET referals = '$refs', date_login = '".time()."', ip = INET_ATON('".$func->UserIP."'), browser = '$user_agent' WHERE id = '".$log_data["id"]."'");<br/>$_SESSION["user_id"] = $log_data["id"];<br/>$_SESSION["user"] = $log_data["user"];<br/>$_SESSION["referer_id"] = $log_data["referer_id"];<br/><br/>### МУЛЬТИКИ ### <br/>$Multi->CheckCookiesLogin($username); <br/>################<br/><br/>if (!$block->checkBlock($username)) {<br/># Обнулим NUM если в базе есть<br/>$block->updateNum($username);<br/>}<br/><br/>header('Refresh: 1; URL=/account/');<br/>} # END проверка в базе<br/><br/>}else{<br/>$pri4ina_banned = $log_data["pri4ina_banned"];<br/>$text_banned = 'Аккаунт заблокирован';<br/>echo $text_banned;<br/>}<br/>}else{<br/><br/> if ($block->updateBlock($username) == NULL) {<br/> echo $func->error("Логин не зарегистрирован");<br/> }else echo $block->updateBlock($username);<br/><br/> # запишем в базу при ошибке<br/> $block->rcGoogleBase();<br/> }<br/><br/> }else{<br/> echo $block->updateBlock($username);#echo $func->error("Попробуйте позже!", true);<br/> # запишем в базу при ошибке<br/> $block->rcGoogleBase();<br/> } <br/><br/> }else{<br/><br/> if ($block->updateBlock($username) == NULL) {<br/> echo $func->error("Логин указан неверно!");<br/> }else echo $block->updateBlock($username);<br/><br/> # запишем в базу при ошибке<br/> $block->rcGoogleBase();<br/><br/> }<br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <br/> }<br/> <br/> <br/> <br/><br/> <br/><br/><br/><br/><br/><br/><br/><br/><br/><br/><br/> <br/> exit();// делаем редирект куда нам нужно<br/>}<br/>?><br/>



Disclaimer: The tools are provided "as is", without warranty of any kind, either express or implied.
Any links to third-party website or software available on this website are provided "as is",
without warranty of any kind, either express or implied and are to be used at your own risk.