class in php
<?php
class Foo {
public $aMemberVar = 'aMemberVar Member Variable';
public $aFuncName = 'aMemberFunc';
function aMemberFunc() {
print 'Inside `aMemberFunc()`';
}
}
$foo = new Foo;
function getVarName()
{
return 'aFuncName';
}
print $foo->{$foo->{getVarName()}}();
public className{
public function __construct(){
//CODE HERE
}
}The PHP Object-Oriented Programming concepts are:
Class
Objects
Inheritance
Interface
Abstraction
Magic Methods$x = (object) [
'a' => 'test',
'b' => 'test2',
'c' => 'test3'
];
var_dump($x);
/*
object(stdClass)#1 (3) {
["a"]=>
string(4) "test"
["b"]=>
string(5) "test2"
["c"]=>
string(5) "test3"
}
*/class Bike {
function Bike() {
$this->type = 'BMX';
}
}
$blackSheep = new Bike();
print $blackSheep->type;$o= new \stdClass();
$o->a = 'new object';
OR
$o = (object) ['a' => 'new object'];
Also in PHP:
- composer global require laravel/
- artisan route list
- check if php contains string
- disable cache laravel 8 development
- Argument 1 passed to NotORM_Result::update() must be of the type array, string php slim
- dispaly object type php
- display current data php
- PHP File Open/Read/Close
- failed to open stream: no such file or directory php
- debian install apache php
- array reverser ph
- Arr::get laravel
- count variable lenth in php
- Y-m-d H:s:i input
- auto generated password in php
- check where key in associative array have a value
- clean url laravel CACHE
- Allowed memory size of 134217728 bytes exhausted (tried to allocate 157 bytes) in C:\wamp64\scripts\refresh.php on line 2263
- disable register in laravel
- destrroy a session php
- create laravel migration
- Database name seems incorrect You're using the default database name laravel. This database does not exist. Edit the .env file and use the correct database name in the DB_DATABASE key.
- codeigniter 3 smtp email send
- date("L")