-->

ABOUT US

Our development agency is committed to providing you the best service.

OUR TEAM

The awesome people behind our brand ... and their life motto.

  • Kumar Atul Jaiswal

    Ethical Hacker

    Hacking is a Speed of Innovation And Technology with Romance.

  • Kumar Atul Jaiswal

    CEO Of Hacking Truth

    Loopholes are every major Security,Just need to Understand it well.

  • Kumar Atul Jaiswal

    Web Developer

    Techonology is the best way to Change Everything, like Mindset Goal.

OUR SKILLS

We pride ourselves with strong, flexible and top notch skills.

Marketing

Development 90%
Design 80%
Marketing 70%

Websites

Development 90%
Design 80%
Marketing 70%

PR

Development 90%
Design 80%
Marketing 70%

ACHIEVEMENTS

We help our clients integrate, analyze, and use their data to improve their business.

150

GREAT PROJECTS

300

HAPPY CLIENTS

650

COFFEES DRUNK

1568

FACEBOOK LIKES

STRATEGY & CREATIVITY

Phasellus iaculis dolor nec urna nullam. Vivamus mattis blandit porttitor nullam.

PORTFOLIO

We pride ourselves on bringing a fresh perspective and effective marketing to each project.

Showing posts with label PHP 7 Tutorial HyperText Preprocessor. Show all posts
Showing posts with label PHP 7 Tutorial HyperText Preprocessor. Show all posts
  • PHP The switch Statement


    PHP The switch Statement


    PHP - The switch Statement



    If you want to select one of many blocks of code to be executed, use the Switch statement.

    The switch statement is used to avoid long blocks of if..elseif..else code.PHP The switch Statement


    Syntax


    switch (expression)
    {
       case label1:
          code to be executed if expression = label1;
          break;  
       
       case label2:
          code to be executed if expression = label2;
          break;
          default:
       
       code to be executed
       if expression is different 
       from both label1 and label2;

    }





    Example



    The switch statement works in an unusual way. First it evaluates given expression then seeks a lable to match the resulting value. If a matching value is found then the code associated with the matching label will be executed or if none of the lable matches then statement will execute any specified default code.








    $d = date("D");
           
             switch ($d)
    {

                case "Mon":
                   echo "Today is Monday";
                   break;
             
                case "Tue":
                   echo "Today is Tuesday";
                   break;
             
                case "Wed":
                   echo "Today is Wednesday";
                   break;
             
                case "Thu":
                   echo "Today is Thursday";
                   break;
             
                case "Fri":
                   echo "Today is Friday";
                   break;
             
                case "Sat":
                   echo "Today is Saturday";
                   break;
             
                case "Sun":
                   echo "Today is Sunday";
                   break;
             
                default:
                   echo "Wonder which day is this ?";
             }
     




    ?>



    </body>
    </html>





    Today is wednesday










    PHP - The if..ifelse...elseif Statement


    The switch statement will be explained in the next chapter. ( Click Here )



    Video on This Topic :- Soon


    I hope you liked this post, then you should not forget to share this post at all.
    Thank you so much :-)





  • PHP decision making if else elseif statements


    PHP decision making if else elseif statements




    Conditional statements are used to perform different actions based on different condtions. The if, elseif ...else statements are used to take decision based on the different condtion.

    You can use conditional statements in your code to make your decision. In PHP we have the following conditional statements:

    • if statement - executes some code if one condition is true






    • if...else statement - executes some code if a condition is true and another code if that condition is false
    • if...elseif...else statement - executes different codes for more than two conditions
    • switch statement - selects one of many blocks of code to be executed




    PHP - The if Statement


    The if statement executes some code if one condition is true.


    Syntax

    if (condition) {
      code to be executed if condition is true;
    }



    Example 



    $b = date("H");

    if ($b < "30") 
    {

      echo "Have a good day!";


    }


    ?>



    </body>
    </html>





    Have a good day!









    PHP - The if...Else Statement


    If you want to execute some code if a condition is true and another code if a condition is false, use the if....else statement. PHP if else elseif statements


    Syntax

    if (condition)
       code to be executed if condition is true;
    else
       code to be executed if condition is false;


    Example


    The following example will output "Have a nice weekend!" if the current day is Friday, Otherwise, it will output "Have a nice day!":


    Example 



       $d = date("D");
             
             if ($d == "Mon")
    {
                echo "Have a nice vacation!"; 
             } 
             else 
    {
                echo "Have a nice day!"; 
    }  


    ?>



    </body>
    </html>




    Have a nice vacation!





    The ElseIf Statement


    If you want to execute some code if one of the several conditions are true use the elseif statement.PHP decision making if else elseif statements


    Syntax


    if (condition)
       code to be executed if condition is true;
    elseif (condition)
       code to be executed if condition is true;
    else
       code to be executed if condition is false;



    Example


    The following example will output "Have a nice weekend!" if the current day is Friday, and "Have a nice Sunday!" if the current day is Sunday. Otherwise, it will output "Have a nice day!" −



    Example 



       $d = date("D");
             
             if ($d == "Fri")
    {
                echo "Have a nice weekend!";
             }
             elseif  ($d == "Sun") {
                echo "Have a nice Sunday!"; 
             }
             else {
                echo "Have a nice day!"; 
          
      
    }

    ?>



    </body>
    </html>




    Have a nice day!




    PHP - The switch Statement


    The switch statement will be explained in the next chapter. ( link will be updated soon )



    Video on This Topic :- Soon


    I hope you liked this post, then you should not forget to share this post at all.
    Thank you so much :-)



  • PHP all types of operator


    PHP all types of operator



    Operators are used to perform operations on some values. In other words, we can describe operators as something that takes some values, performs some operation on them and gives a result. From example, “1 + 2 = 3” in this expression ‘+’ is an operator. It takes two values 1 and 2, performs addition operation on them to give 3.

    Just like any other programming language, PHP also supports various types of operations like the arithmetic operations(addition, subtraction, etc), logical operations(AND, OR etc), Increment/Decrement Operations etc.  PHP all types of operator





    PHP divides the operators in the following groups:


    • Arithmetic operators
    • Assignment operators
    • Comparison operators
    • Increment/Decrement operators
    • Logical operators
    • String operators
    • Array operators
    • Conditional assignment operators




    Arithmetic operator



    The arithmetic operators are use to perform simple mathematical operations like addition, subtraction, multiplication etc. Below is the list of arithmetic operators along with there syntax and operations, that PHP provides us:



    PHP all types of operator



    Example 


    $x = 18;  
    $y = 6;

    echo $x + $y;
    echo "<br>";

    echo $x - $y;
    echo "<br>";

    echo $x * $y;
    echo "<br>";

    echo $x / $y;
    echo "<br>";

    echo $x % $y;
    echo "<br>";

    echo $x ** $y;
    echo "<br>";

    ?>



    </body>
    </html>





    24
    12
    108
    3
    0
    34012224





    Assignment operators


    These operators are used to assign values to different variable, with or without mid-operations. Here are the assignment operators along with there syntax and operations, that PHP provides us:



    PHP all types of operator



    Example 




    $a = 20;  
    $a += 100;

    echo $a;
    echo "<br>";


    $b = 10;  
    echo $b;
    echo "<br>";


    $c = 200;  
    $c -= 100;

    echo $c;
    echo "<br>";


    $d = 8;  
    $e = 6;

    echo $d * $e;
    echo "<br>";


    $f = 60;
    $f /= 6;

    echo $f;
    echo "<br>";


    $g = 15;
    $g %= 4;

    echo $g;
    echo "<br>";

    ?>



    </body>
    </html>





    120
    10
    100
    48
    10
    3

     

    Comparison Operators


    These operators are used to compare two elements and outputs the result in boolean form. Here are the comparison operators along with there syntax and operations, that PHP provides us:



    PHP all types of operator


    Example 


    $x = 100;  
    $y = "100";

    var_dump($x == $y); // returns true because values are equal

    echo "<br>";

    $a = 200;  
    $b = "200";

    var_dump($a === $b); // returns false because types are not equal


    echo "<br>";

    $c = 100;  
    $d = "100";

    var_dump($c != $d); // returns false because values are equal

    echo "<br>";


    $e = 100;  
    $f = "100";

    var_dump($e <> $f); // returns false because values are equal
    echo "<br>";


    $g = 100;  
    $h = "100";

    var_dump($g !== $h); // returns true because types are not equal
    echo "<br>";


    $i = 100;
    $j = 50;

    var_dump($i > $j); // returns true because $x is greater than $y
    echo "<br>";


    $x = 10;
    $y = 50;

    var_dump($x < $y); // returns true because $x is less than $y
    echo "<br>";


    $k = 50;
    $l = 50;

    var_dump($k >= $l); // returns true because $x is greater than or equal to $y
    echo "<br>";



    $m = 50;
    $n = 50;

    var_dump($m <= $n); // returns true because $x is less than or equal to $y
    echo "<br>";



    $o = 5;  
    $p = 10;

    echo ($o <=> $p); // returns -1 because $x is less than $y
    echo "<br>";


    $q = 10;  
    $r = 10;

    echo ($q <=> $r); // returns 0 because values are equal
    echo "<br>";


    $s = 15;  
    $t = 10;


    echo ($s <=> $t); // returns +1 because $x is greater than $y
    echo "<br>";
    echo "<br>";



    ?>



    </body>
    </html>





    bool(true)
    bool(false)
    bool(false)
    bool(false)
    bool(true)
    bool(true)
    bool(true)
    bool(true)
    bool(true)
    -1
    0
    1

     




    Logical or Relational Operators



    These are basically used to operate with conditional statements and expressions. Conditional statements are based on conditions. Also, a condition can either be met or cannot be met so the result of a conditional statement can either be true or false. Here are the logical operators along with there syntax and operations, that PHP provides us:



    PHP all types of operator



    Example 


    $x = 100;  
    $y = 50;

    if ($x == 100 and $y == 50) {
        echo "Hello world!";
    }

    echo "<br>";

    $a = 100;  
    $b = 50;

    if ($a == 100 or $b == 80) {
        echo "Hello kumarAtulJaiswal!";
    }

    echo "<br>";

    $d = 100;  
    $e = 50;

    if ($d == 100 xor $e == 80) {
        echo "welcome to our YT channel!";
    }

    echo "<br>";

    $f = 100;  
    $g = 50;

    if ($f == 100 && $g == 50) {
        echo "Hello world!";
    }

    echo "<br>";
    $h = 100;  
    $i = 50;

    if ($h == 100 || $i == 80) {
        echo "Dont forget to subscribe!";
    }

    echo "<br>";

    $j = 100;  

    if ($j !== 90) {
        echo "Hello viewers!";
    }

    ?>



    </body>
    </html>




    Hello world!
    Hello kumarAtulJaiswal!
    welcome to our YT channel!
    Hello world!
    Dont forget to subscribe!
    Hello viewers!



    ----------------



    Increment operators


    The PHP increment operators are used to increment a variable's value. ++a is pre increment in this case first value will be increase then assign in variable. Both will increase the value by 1. ++a: do the increment first then return the value of a. a++: return the value of a first, then increment after.



    PHP all types of operator




    Example 



    $a = 10;
    echo ++$a;

    echo "<br>";

    $b = 10;
    echo $b++;

    echo "<br>";

    $c = 10;
    echo --$c;

    echo "<br>";

    $d = 10;
    echo $d--;




    ?>



    </body>
    </html>



    11
    10
    9
    10

    ----------------

    PHP String Operators


    PHP has two operators that are specially designed for strings.



    PHP all types of operator



    Example 



    $txta = "Hello";
    $txtb = " world!";
    echo $txta . $txtb;

    echo "<br>";


    $txtc = "Hello";
    $txtd = " world!";
    $txtc .= $txtd;
    echo $txtc;



    ?>



    </body>
    </html>




    Hello world!
    Hello world!



     



    Array Operators


    The PHP array operators are used to compare arrays.






    Example 



    </head>
    <body>


    $xa = array("a" => "red", "b" => "green");  
    $yb = array("c" => "blue", "d" => "yellow");  

    print_r($xa + $yb); // union of $x and $y

    echo "<br>";

    $a = array("a" => "red", "b" => "green");  
    $b = array("c" => "blue", "d" => "yellow");  

    var_dump($a == $b);

    echo "<br>";

    $c = array("a" => "red", "b" => "green");  
    $d = array("c" => "blue", "d" => "yellow");  

    var_dump($c === $d);

    echo "<br>";

    $e= array("a" => "red", "b" => "green");  
    $f= array("c" => "blue", "d" => "yellow");  

    var_dump($e!= $f);

    echo "<br>";

    $g= array("a" => "red", "b" => "green");  
    $h= array("c" => "blue", "d" => "yellow");  

    var_dump($g <> $h);

    echo "<br>";

    $i = array("a" => "red", "b" => "green");  
    $j = array("c" => "blue", "d" => "yellow");  

    var_dump($i !== $j);

    echo "<br>";


    ?>



    </body>
    </html>




    Array ( [a] => red [b] => green [c] => blue [d] => yellow )
    bool(false)
    bool(false)
    bool(true)
    bool(true)
    bool(true)


    ----------------



    PHP Conditional Assignment Operators


    The PHP conditional assignment operators are used to set a value depending on conditions:



    PHP all types of operator




    Example 




    </head>
    <body>


    // if empty($user) = TRUE, set $status = "anonymous"

    echo $status = (empty($user)) ? "anonymous" : "logged in";
      
    echo "<br>";

    $user = "John Doe";

    // if empty($user) = FALSE, set $status = "logged in"
    echo $status = (empty($user)) ? "anonymous" : "logged in";
       
    echo "<br>";
       
       
    // variable $user is the value of $_GET['user']
    // and 'anonymous' if it does not exist
      
    echo $user = $_GET["user"] ?? "anonymous";

    echo "<br>";
      
    // variable $color is "red" if $color does not exist or is null
    echo $color = $color ?? "red";
     

      echo "<br>";


    ?>



    </body>
    </html>




    anonymous
    logged in
    anonymous
    red






    Video on This Topic :- Soon


    I hope you liked this post, then you should not forget to share this post at all.
    Thank you so much :-)



  • WHAT WE DO

    We've been developing corporate tailored services for clients for 30 years.

    CONTACT US

    For enquiries you can contact us in several different ways. Contact details are below.

    Hacking Truth.in

    • Street :Road Street 00
    • Person :Person
    • Phone :+045 123 755 755
    • Country :POLAND
    • Email :contact@heaven.com

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.