Search
 
SCRIPT & CODE EXAMPLE
 

PHP

$$ in php

$x = "abc";  
$$x = 200;  
echo $x."<br/>";  
echo $$x."<br/>";  
echo $abc; 

// output:
abc
200
200
Comment

: in PHP

/*
This is an easy way to execute conditional html / 
javascript / css / other language code with 
php if else:

No need for curly braces {}
*/
<?php if (condition): ?>

// html / javascript / css / other language code to run if condition is true

<?php else: ?>

// html / javascript / css / other language code to run if condition is false

<?php endif ?>
Comment

? in php

/* 
in php, ? is the 'Ternary Operator'.

The expression (expr1) ? (expr2) : (expr3) evaluates 
to expr2 if expr1 evaluates to true, and expr3 if 
expr1 evaluates to false.

It is possible to leave out the middle part of the 
ternary operator. Expression expr1 ?: expr3 evaluates 
to the result of expr1 if expr1 evaluates to true, 
and expr3 otherwise. expr1 is only evaluated once in 
this case.
*/

<?php
// Example usage for: Ternary Operator
$action = (empty($_POST['action'])) ? 'default' : $_POST['action'];

// The above is identical to this if/else statement
if (empty($_POST['action'])) {
    $action = 'default';
} else {
    $action = $_POST['action'];
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: laravel index method 
Php :: laravel route limit parameter 
Php :: PHP Iterables 
Php :: laravel orderby LCASE 
Php :: wordpress get default date format 
Php :: wpquery search taxonomy 
Php :: get the user detail inside the constructor Laravel 
Php :: codeigniter 3 session not working after some time 
Php :: s how to store jwt in http cookie laravel 
Php :: only get selected value from has many ralation laravel 
Php :: php unique id length 
Php :: wp post view 
Php :: php variable 
Php :: parse php 
Php :: routing with php 
Php :: laravel verify email custom url 
Php :: php undefined offset 
Php :: Export Database Records to CSV 
Php :: nested loop in php 
Php :: getting routes in middleware laravel 
Php :: assign random to a variable in PHP 
Php :: Make livewire component 
Php :: laravel where in query builder 
Php :: loop through objects in php 
Php :: delete rows by migration laravel 
Php :: crypt password php 
Php :: create table laravel give name table 
Php :: how to execute php in linux 
Php :: laravel 8 login logout 
Php :: laravel imap - Set message flags 
ADD CONTENT
Topic
Content
Source link
Name
8+2 =