Answers for "php define"

PHP
13

strpos in php

<?php
$mystring = 'abc';
$findme   = 'a';
$pos = strpos($mystring, $findme);

// Note our use of ===.  Simply == would not work as expected
// because the position of 'a' was the 0th (first) character.
if ($pos === false) {
    echo "The string '$findme' was not found in the string '$mystring'";
} else {
    echo "The string '$findme' was found in the string '$mystring'";
    echo " and exists at position $pos";
}
?>
Posted by: Guest on March-13-2020
1

define in php

//define() is used to create constants
define(name,value);
//here name has to be a string
//here value can be string, integer, float, boolean or NULL, 
//and can be an array to if you are using PHP 7.0+

//define() before php 7.3
define(name,value,case_insensitive);
//case_insensitive is optional and can be TRUE or FALSE by default its false
Posted by: Guest on April-04-2021
0

php define()

<?php

 define("cars", [
  "Alfa Romeo",
  
  "BMW",
  "Toyota"
]);
echo cars[0];
?>
Posted by: Guest on September-14-2021
-1

define php

define("name", {value});
Posted by: Guest on November-24-2020
0

define value in php

$var = 5; //int
$var = "hey"; //string
$var = 'A'; //char
Posted by: Guest on November-25-2020

Browse Popular Code Answers by Language