Different between array and dynamic array in PHP
class static_array {
public $bar = "BIKE";
}
class myClass {
static public $array = array();
static public function init() {
while ( count( self::$array ) < 3 )
array_push( self::$array, new static_array() );
}
}
myClass::init();
print_r( myClass::$array );
$color = array("blue","black","white","red","green");
print_r($color);
<html>
<head>
<title>Different between array and dynamic array in PHP</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
</head>
<body>
<div class="container ">
<div class="text-center">
<h1>Different between Array and Dynamic array in PHP</h1>
</div>
<br>
<h3>Array</h3>
<div class="well">
<?php
class static_array {
public $bar = "BIKE";
}
class myClass {
static public $array = array();
static public function init() {
while ( count( self::$array ) < 3 )
array_push( self::$array, new static_array() );
}
}
myClass::init();
print_r( myClass::$array );
?>
</div>
<h3>Dynamic Array</h3>
<div class="well">
<?php
$color = array("blue","black","white","red","green");
print_r($color);
?>
</div>
</div>
</body>
</html>