Answers for "php declare variable"

PHP
10

php variables

<?php
  $string = 'string';
  $number = 1;
?>
Posted by: Guest on October-02-2020
4

php variables

<?php
/* In PHP, a variable starts with the $ sign, 
followed by the name of the variable:
*/

$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>
Posted by: Guest on April-30-2020
5

php variables

<?php
    //can also use print instead of echo and would return  but it is
    //slower so use echo mainly
    #variable rules
    /*
        - Prefix with a dollar sign $
        - Start with a letter or an underscore only
        - Only letters, numbers and underscores
        - Case sensative
    */

    #DATA TYPES
    /*
        Strings
        Integers 4
        floats 4.4
        Booleans True or Flase
        Arrays
        Objects
        Null
        Resources 
    */
    $output = '  Hello there Bob!!';
    $num1 = 4;
    $num2 =10;
    $sum = $num1 + $num2;
    $string1 = '  Hello';
    $string2 = 'Bobby!!';
    $greeting = $string1 .' '. $string2;
    $greeting2 = "$string1 $string2";

    $string3 = ' They\'re Here';

    #making a constant

    define('GREETING', ' Hello Everyone!!');

    echo $sum;
    echo $output;
    echo $greeting;
    echo $greeting2;
    echo $string3;
    echo GREETING;
?>
Posted by: Guest on May-13-2020
1

PHP Variables

<?php
$txt = "Hello world!";
$x = 5;
$y = 10.5;
?>
Posted by: Guest on November-27-2020
0

php variable

$name = "Josh"; //$varname = value
Posted by: Guest on April-27-2020
0

php declare variable

// just assign it some value to declare it
$var = 'some value';
Posted by: Guest on February-17-2021

Browse Popular Code Answers by Language