/* PHP's full form is Hypertext Preprocesser
It is a programming language made by Rasmus Lerdorf
It is case sensitive for variable names and for functions, it's not. */
<?phpclassBaseClass{publicfunctiontest(){echo"BaseClass::test() called
";}finalpublicfunctionmoreTesting(){echo"BaseClass::moreTesting() called
";}}classChildClassextendsBaseClass{publicfunctionmoreTesting(){echo"ChildClass::moreTesting() called
";}}// Results in Fatal error: Cannot override final method BaseClass::moreTesting()?>
<?phpclassPropertyTest{/** Location for overloaded data. */private$data=array();/** Overloading not used on declared properties. */public$declared=1;/** Overloading only used on this when accessed outside the class. */private$hidden=2;publicfunction__set($name,$value){echo"Setting '$name' to '$value'
";$this->data[$name]=$value;}publicfunction__get($name){echo"Getting '$name'
";if(array_key_exists($name,$this->data)){return$this->data[$name];}$trace=debug_backtrace();trigger_error('Undefined property via __get(): '.$name.' in '.$trace[0]['file'].' on line '.$trace[0]['line'],E_USER_NOTICE);returnnull;}/** As of PHP 5.1.0 */publicfunction__isset($name){echo"Is '$name' set?
";returnisset($this->data[$name]);}/** As of PHP 5.1.0 */publicfunction__unset($name){echo"Unsetting '$name'
";unset($this->data[$name]);}/** Not a magic method, just here for example. */publicfunctiongetHidden(){return$this->hidden;}}echo"<pre>
";$obj=newPropertyTest;$obj->a=1;echo$obj->a."
";var_dump(isset($obj->a));unset($obj->a);var_dump(isset($obj->a));echo"
";echo$obj->declared."
";echo"Let's experiment with the private property named 'hidden':
";echo"Privates are visible inside the class, so __get() not used...
";echo$obj->getHidden()."
";echo"Privates not visible outside of class, so __get() is used...
";echo$obj->hidden."
";?>
// Example usage for: Null Coalesce Operator$action=$_POST['action']??'default';// The above is identical to this if/else statementif(isset($_POST['action'])){$action=$_POST['action'];}else{$action='default';}
PHP stands for Hypertext Preprocessor.
It is an open source server-side scripting language which is widely used for web development.
It supports many databases like MySQL, Oracle, Sybase, Solid, PostgreSQL, generic ODBC etc.
<pre><?php$userid=$getuser->user_id;$userPhone=tp_input($_POST['userPhone']);$userEmail=tp_input($_POST['userEmail']);if(isset($_POST['actionSubmit'])){$checkExist=tp_query("SELECT * FROM `user`
WHERE
`user_id`='$userid'");while($userInfo=tp_fetch_object($checkExist)){if(tp_num_rows($checkExist)!=""){tp_query("UPDATE `user`
SET
`username`='$username',
`userage`='$userage'
WHERE
`user_id`='$userid' ");}else{echo"Fail Updated ";}}}?>
publicfunctionupdate_code($email,$code){$sql="Update Users set code = $code where email_u = '$email'";$query=$this->query($sql);if($query){echo'1';}else{echo'0';}}
date_default_timezone_set('asia/Dhaka');$expire=strtotime("-1 days");if($expire<=time()){echo'<br>Expired on '.date('F j, Y, g:i:s A',$expire);}else{echo'<br>Running until '.date('F j, Y, g:i:s A',$expire);}
PHP: Hypertext Preprocessor
PHP is a server scripting language,and a powerful tool for making dynamic and interactive Web pages.PHP is a widely-used, free,and efficient alternative to competitors such as Microsoft's ASP
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994. The PHP reference implementation is now produced by The PHP Group.
date_default_timezone_set('asia/Dhaka');$expire=strtotime("-1 days");if($expire<=time()){echo'<br>Expired on '.date('F j, Y, g:i:s A',$expire);}else{echo'<br>Running until '.date('F j, Y, g:i:s A',$expire);}
date_default_timezone_set('asia/Dhaka');$expire=strtotime("-1 days");if($expire<=time()){echo'<br>Expired on '.date('F j, Y, g:i:s A',$expire);}else{echo'<br>Running until '.date('F j, Y, g:i:s A',$expire);}
"enablePhpTooling":true,//true for enable the PHP features and false for //disable the PHP features."executablePath":"php",// this is the path format, for MAC and Linux, // the path is “/users/someuser/bin/php. // For windows, the path is c:path ophp.exe."memoryLimit":"5904M",// indicates the memory limit for the PHP language // server process."validateOnType":"false",// the ‘on type’ or ‘on save’ are the configuration// to have the diagnostics."livedev.multibrowser":false
$sql="SELECT * FROM food WHERE cropName = 'Rice' AND foodName =
'Foodname1' ";$result=mysqli_query($connect,$sql);$num_rows=mysqli_num_rows($result);if($num_rows>0){$jsonData=array();while($array=mysqli_fetch_row($result)){$jsonData[]=$array;}}classEmp{public$majorFoods="";}$e=newEmp();$e->majorFoods=$jsonData;header('Content-type: application/json');echojson_encode($e);
PHP is a general-purpose scripting language geared toward web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1993and released in 1995. The PHP reference implementation is now produced by The PHP Group.
<?php$connect=mysqli_connect("localhost","root","","testing");if(isset($_POST["insert"])){$file=addslashes(file_get_contents($_FILES["image"]["tmp_name"]));$query="INSERT INTO tbl_images(name) VALUES ('$file')";if(mysqli_query($connect,$query)){echo'<script>alert("Image Inserted into Database")</script>';}}?><!DOCTYPEhtml><html><head><title>Webslesson Tutorial | Insert and Display Images From Mysql Database in PHP</title><scriptsrc="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script><linkrel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/><scriptsrc="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script></head><body><br/><br/><divclass="container"style="width:500px;"><h3align="center">Insert and Display Images From Mysql Database in PHP</h3><br/><formmethod="post"enctype="multipart/form-data"><inputtype="file"name="image"id="image"/><br/><inputtype="submit"name="insert"id="insert"value="Insert"class="btn btn-info"/></form><br/><br/><tableclass="table table-bordered"><tr><th>Image</th></tr><?php$query="SELECT * FROM tbl_images ORDER BY id DESC";$result=mysqli_query($connect,$query);while($row=mysqli_fetch_array($result)){echo'
<tr>
<td>
<img src="data:image/jpeg;base64,'.base64_encode($row['name']).'" height="200" width="200" class="img-thumnail" />
</td>
</tr>
';}?></table></div></body></html><script>$(document).ready(function(){$('#insert').click(function(){var image_name =$('#image').val();if(image_name ==''){alert("Please Select Image");returnfalse;}else{var extension =$('#image').val().split('.').pop().toLowerCase();if(jQuery.inArray(extension,['gif','png','jpg','jpeg'])==-1){alert('Invalid Image File');$('#image').val('');returnfalse;}}});});</script>
PHP is a general-purpose scripting language especially suited to
web development.
It was originally created by Danish-Canadian programmer
Rasmus Lerdorf in 1994;
the PHP reference implementation is now produced by The PHP Group
Implementation language:C(primarily; some components C++)
<?phpnamespaceAppHttpControllers;useIlluminateHttpRequest;classProductsControllerextendsController{publicfunctionindex(){$title="Welcome to my Laravel 8 course";$description="Created by Dary";$data=['productOne'=>'iPhone','productTwo'=>'Samsung'];//Compact method //return view('products.index', // compact('title', 'description)); //with method //return view('products.index')->with('title', $title); //Directly in the view return view('products.index', [ ]); } public function about() {
/* PHP is a general-purpose scripting language geared towards web development. It was originally created by Danish-Canadian programmer Rasmus Lerdorf in 1994. The PHP reference implementation is now produced by The PHP Group. */
<?phppublicclassUser{public$userid;public$username;private$password;publicclassUserProfile{// some code here}privateclassUserHistory{// some code here}}?>
// Example usage for: Ternary Operator$action=$_POST['action']?:'default';// The above is identical to this if/else statementif(empty($_POST['action'])){$action='default';}else{$action=$_POST['action'];}