Preguntas y respuestas de entrevista mas solicitadas y pruebas en linea
Plataforma educativa para preparacion de entrevistas, pruebas en linea, tutoriales y practica en vivo

Desarrolla tus habilidades con rutas de aprendizaje enfocadas, examenes de practica y contenido listo para entrevistas.

WithoutBook reune preguntas de entrevista por tema, pruebas practicas en linea, tutoriales y guias comparativas en un espacio de aprendizaje responsivo.

Preparar entrevista

PHP OOPs preguntas y respuestas de entrevista

Pregunta 16. What is a trait in PHP?

A trait is similar to a class but intended to group functionality in a fine-grained and consistent way. Traits are used to declare methods in a class.

Example:

trait Loggable { 
public function log($message) 
{
 echo $message; 



class User { 
use Loggable; 
}

Es util? Agregar comentario Ver comentarios
 

Pregunta 17. What is the difference between an abstract class and an interface?

An abstract class can have both abstract and non-abstract methods, and it can have properties. Interfaces can only have abstract methods and constants.

Es util? Agregar comentario Ver comentarios
 

Pregunta 18. Explain late static binding in PHP.

Late static binding allows static methods to reference the called class using the 'static' keyword. It helps resolve the class at runtime rather than at compile time.

Example:

class ParentClass { 
public static function whoAmI() { 
echo static::class; 

}

 class ChildClass extends ParentClass { } 
ChildClass::whoAmI(); // Outputs 'ChildClass'

Es util? Agregar comentario Ver comentarios
 

Pregunta 19. What is the use of the 'self' keyword in PHP?

The 'self' keyword is used to refer to the current class. It is used to access static properties and methods within the class itself.

Example:

class Example { 
private static $counter = 0; 
public static function incrementCounter() { 
self::$counter++; 

}

Es util? Agregar comentario Ver comentarios
 

Pregunta 20. Explain the Singleton design pattern in PHP.

The Singleton pattern ensures that a class has only one instance and provides a global point of access to that instance. It involves a private constructor and a static method to get the instance.

Example:

class Singleton { 
private static $instance; 
private function __construct() { /* private constructor */ } public static function getInstance() { 
if (!self::$instance) { 
self::$instance = new self(); 

return self::$instance; 

}

Es util? Agregar comentario Ver comentarios
 

Lo mas util segun los usuarios:

Copyright © 2026, WithoutBook.