Skip to content

nielsoffice/PHP_HandlingObjectInsideArrayFunc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

PHPHandlingObjectInsideArrayFunc

PHP execute data in object inside the array function

  Class Person {
 	
   public function name( $name) { return $name; }	
   
   public function cc() { return 123; }
   
  }
 
 function data() {
 	
   return [
 	
 	 'request' => function( ) { 
 	 	
 	 	$name = new Person();
 	  
 		return implode('', [ $name->name('na') , $name->cc() ]);
 		
 	 },
 	 'get' => function() : int { return (int) 1230; }
 	
 	];
 	
 }

  var_dump( data()["request"]());

 // Result: string(5) "na123"


Reference:
https://github.com/PHPWine/PHPVanilla/blob/main/Crud/Vanilla.php
https://github.com/PHPWine/PHPVanilla/tree/main

About

PHP execute data in object inside the array function

Topics

Resources

Stars

Watchers

Forks