<?php $string = "Claudionor,Gomes,de,Macedo,Raymundo"; /* Use tab e newline como caractere delimitador, que funciona bem */ $tok = strtok($string,","); $surname = ""; while ($tok !== false) { echo "Word=$tok<br/>"; $tok = strtok(","); } $surname = substr($surname, 0, -2); //echo "\"$surname\"<br/>"; $cpf = "05860633823"; $quid = substr($cpf, 0, -2); $uidnumber = intval($quid); echo "$uidnumber<br/>"; $cidade = "Sao Paulo"; $estado = "SP"; $evento = "SIGGRAPH"; $localidade = array("cidade", "estado"); $result = compact("evento", "nada_aqui", $localidade); print_r($result); echo "<br><br>"; $serproadmissao = "asdjhkjashdkasjd"; $serproafastamento = "asdba3423423423423"; $balalaika = "a"; $serpro = compact("serproadmissao", "serproafastamento", "balalaika"); var_dump($serpro); ?>
<?php if(isset($_FILES['image'])){ $errors= array(); $file_name = $_FILES['image']['name']; $file_size =$_FILES['image']['size']; $file_tmp =$_FILES['image']['tmp_name']; $file_type=$_FILES['image']['type']; $file_ext=strtolower(end(explode('.',$_FILES['image']['name']))); $expensions= array("jpeg","jpg","png"); if(in_array($file_ext,$expensions)=== false){ $errors[]="extension not allowed, please choose a JPEG or PNG file."; } if($file_size > 2097152){ $errors[]='File size must be excately 2 MB'; } if(empty($errors)==true){ move_uploaded_file($file_tmp,"images/".$file_name); echo "Success"; }else{ print_r($errors); } } ?> <html> <body> <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="image" /> <input type="submit"/> </form> </body> </html>
<html> <head> <title>Online PHP Script Execution</title> </head> <body> <?php function IsPrime($n) { for($x=2; $x<$n; $x++) { if($n %$x ==0) { return 0; } } return 1; } for($x=2; $x<100; $x++) {$a = IsPrime($x); if ($a==0) echo "$x is not a Prime Number....."."<br>"; else echo "$x is a Prime Number.."."<br>"; } ?> </body> </html>
<?php ob_start(); session_start(); ?> <? // error_reporting(E_ALL); // ini_set("display_errors", 1); ?> <html lang = "en"> <head> <title>Tutorialspoint.com</title> <link href = "css/bootstrap.min.css" rel = "stylesheet"> <style> body { padding-top: 40px; padding-bottom: 40px; background-color: #ADABAB; } .form-signin { max-width: 330px; padding: 15px; margin: 0 auto; color: #017572; } .form-signin .form-signin-heading, .form-signin .checkbox { margin-bottom: 10px; } .form-signin .checkbox { font-weight: normal; } .form-signin .form-control { position: relative; height: auto; -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; padding: 10px; font-size: 16px; } .form-signin .form-control:focus { z-index: 2; } .form-signin input[type="email"] { margin-bottom: -1px; border-bottom-right-radius: 0; border-bottom-left-radius: 0; border-color:#017572; } .form-signin input[type="password"] { margin-bottom: 10px; border-top-left-radius: 0; border-top-right-radius: 0; border-color:#017572; } h2{ text-align: center; color: #017572; } </style> </head> <body> <h2>Enter Username and Password</h2> <div class = "container form-signin"> <?php $msg = ''; if (isset($_POST['login']) && !empty($_POST['username']) && !empty($_POST['password'])) { if ($_POST['username'] == 'tutorialspoint' && $_POST['password'] == '1234') { $_SESSION['valid'] = true; $_SESSION['timeout'] = time(); $_SESSION['username'] = 'tutorialspoint'; echo 'You have entered valid use name and password'; }else { $msg = 'Wrong username or password'; } } ?> </div> <!-- /container --> <div class = "container"> <form class = "form-signin" role = "form" action = "<?php echo htmlspecialchars($_SERVER['PHP_SELF']); ?>" method = "post"> <h4 class = "form-signin-heading"><?php echo $msg; ?></h4> <input type = "text" class = "form-control" name = "username" placeholder = "username = tutorialspoint" required autofocus></br> <input type = "password" class = "form-control" name = "password" placeholder = "password = 1234" required> <button class = "btn btn-lg btn-primary btn-block" type = "submit" name = "login">Login</button> </form> Click here to clean <a href = "logout.php" tite = "Logout">Session. </div> </body> </html>
<html> <body> <?php $marks = array( "mohammad" => array ( "physics" => 35, "maths" => 30, "chemistry" => 39 ), "qadir" => array ( "physics" => 30, "maths" => 32, "chemistry" => 29 ), "zara" => array ( "physics" => 31, "maths" => 22, "chemistry" => 37 ) ); /* Accessing multi-dimensional array values */ echo "Marks for mohammad in physics : " ; echo $marks['mohammad']['physics'] . "<br />"; echo "Marks for qadir in maths : "; echo $marks['qadir']['maths'] . "<br />"; echo "Marks for zara in chemistry : " ; echo $marks['zara']['chemistry'] . "<br />"; ?> </body> </html>
<?php foreach (filter_list() as $id => $filter) { echo '<tr><td>' . $filter . '</td><td>' . filter_id($filter) . '</td></tr>'; } ?>
<?php if(isset($_FILES['image'])){ print "asdasd";exit; $errors= array(); $file_name = $_FILES['image']['name']; $file_size =$_FILES['image']['size']; $file_tmp =$_FILES['image']['tmp_name']; $file_type=$_FILES['image']['type']; $file_ext=strtolower(end(explode('.',$_FILES['image']['name']))); $expensions= array("jpeg","jpg","png"); if(in_array($file_ext,$expensions)=== false){ $errors[]="extension not allowed, please choose a JPEG or PNG file."; } if($file_size > 2097152){ $errors[]='File size must be excately 2 MB'; } if(empty($errors)==true){ move_uploaded_file($file_tmp,"images/".$file_name); echo "Success"; }else{ print_r($errors); } } ?> <html> <body> <form action="" method="POST" enctype="multipart/form-data"> <input type="file" name="image" /> <input type="submit"/> </form> </body> </html>
<html> <body> <?php $array = array( 1, 2, 3, 4, 5); foreach( $array as $value ) { if( $value == 3 )continue; echo "Value is $value <br />"; } ?> </body> </html>
<?php if(isset($_POST['send'])){ $username=$_POST['username']; } ?> <html> <head> <title>Online chart</title> </head> <body> <div class="container"> <div class="header" style="background-color:black; color:whitesmoke;"> <ul> <li> <span style="color:maroon; font-weight:bolder; font-size:23px;">Chatroom</span></li> <li ><a href="#">Home</a></li> <li ><a href="#">login</a></li> <li ><a href="#">Logout</a></li> </ul> </div> <div class="contents" style="background-color:skyblue; width:100%; height:70px;"> <div class="left" style="background-color:darkblue;"> <div class="hea"> <h3 style="color:white; font-weight:bolder;">CHATROOM MEMBERS</h3> </div> </div> <div class="right"> <div class="right-head"> <span style="color:green;">HIE <a href="#"><?php echo $username ?></a></span> </div> <div class="main-content"> <textarea cols="80px" style="bolder:6px doubled purple;" rows="30"></textarea> <form action="main.php" method="POST"> <input type="submit" name="send" value="SEND"> </form> </div> </div> </div> </div> <?php echo "<h1>WELCOME TO CHATROOM</h1>\n"; ?> </body> </html>
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more