Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php array destructuring

<?php

$person = ['John','Doe'];
[$first_name, $last_name] = $person;

var_dump($first_name, $last_name);
Code language: PHP (php)
Comment

destruct php

class Example1
{
   public $cache_file;

   function __construct()
   {
      // some PHP code...
   }

   function __destruct()
   {
      $file = "/var/www/cache/tmp/{$this->cache_file}";
      if (file_exists($file)) @unlink($file);
   }
}

// some PHP code...

$user_data = unserialize($_GET['data']);

// some PHP code...
Comment

PHP OOP - Destructor

<?php
class Fruit {
  public $name;
  public $color;

  function __construct($name) {
    $this->name = $name;
  }
  function __destruct() {
    echo "The fruit is {$this->name}.";
  }
}

$apple = new Fruit("Apple");
?>
Comment

PREVIOUS NEXT
Code Example
Php :: apache use public folder as root 
Php :: integer data type php 
Php :: echo php in html 
Php :: php, Africa timezones 
Php :: constants in php 
Php :: php warning: php startup: unable to load dynamic library 
Php :: executar comando linux php 
Php :: Laravel - Resize image size using Laravel image class 
Php :: -store() laravel change name 
Php :: join string php 
Php :: laravel bootstrap navbar active 
Php :: how to pass parameters to relationships laravel 
Php :: ternary in php 
Php :: laravel check if collection has value 
Php :: symfony form submit on refresh 
Php :: execute php mysql securely 
Php :: php get array key 
Php :: check if custom post type exists 
Php :: Laravel 8 - get values of url query strings in controller 
Php :: auto refresh extintion php 
Php :: laravel sanctum 
Php :: command to create middleware in laravel 
Php :: finding second highest number in array 
Php :: laravel nginx 
Php :: laravel migration smallint length 
Php :: php public folder 
Php :: php huruf besar di awal 
Php :: php sentense case 
Php :: Add button next to "ADD TO CART" on product archive 
Php :: remove jquery wp 
ADD CONTENT
Topic
Content
Source link
Name
9+2 =