Alok Prasad has Published 52 Answers

What is the use of ini_set() in PHP?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 12:50:11

PHP allows the user to modify some of its settings mentioned in php.ini using ini_set(). This function requires two string arguments. The first one is the name of the setting to be modified and the second one is the new value to be assigned to it.Parametersvar nameNot all the available ... Read More

Is PHP compiled or interpreted?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 12:49:09

Basically, PHP is interpreted but PHP is compiled down to an intermediate bytecode that is then interpreted by the runtime Zend engine.PHP compiler is responsible forconvert the code to a bytecode that can be used by the runtime engine.resolve functions, names and classes namescreating a symbol tablePHP Interpreter doesGoes through ... Read More

Differentiate between exception and error in PHP

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 12:48:40

Let's discuss the differences between errors and exceptions.Recovering from Error is not possible. The only solution to errors is to terminate the execution. Whereas we can recover from Exception by using either try-catch blocks or throwing an exception back to the caller.You will not be able to handle the Errors ... Read More

What do we mean by hash functions in PHP?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 12:26:55

A hash function is any function that can be used to map data of arbitrary size to data of a fixed size. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes.Syntaxstring hash( string $algo , string $data [, bool $raw_output = FALSE ... Read More

What is Exception Handling in PHP ?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 12:05:32

An exception is a problem that arised during the execution of a program. During the execution of a program when an exception occurs, code following the statement will not be executed, and PHP will attempt to find the first matching catch block. If an exception is not caught, a PHP ... Read More

What is the meaning of a Persistent Cookie in PHP?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 12:04:35

A persistent cookie is a cookie that is stored in a cookie file permanently on the browser's computer. As we know cookies are small text files which are as a matter, of course, temporary cookies which stored only in the browser's memory. When the browser is closed, temporary cookies will ... Read More

What is traits in PHP?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 12:02:51

In 5.4 PHP version trait is introduced to PHP object-oriented programming. A trait is like class however it is only for grouping methods in a fine-grained and reliable way. It isn't permitted to instantiate a trait on its own. Traits are introduced to PHP 5.4 to overcome the problems of ... Read More

Program to find how many times a character appears in a string in PHP

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 11:59:22

Example Live Demo<?php    $str = "welcome to tutorials point";    $str = str_replace(" ", "", $str);    $arr = str_split($str);    foreach ($arr as $key =>$val){       if (!isset($output[$val])){             $output[$val] = 1;       }       else{     ... Read More

What is .htaccess in PHP?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 11:58:23

.htaccess is a configuration file for use on web servers running on the web apache server software. when a .htaccess file is placed in a directory which in turn loaded via the Apache web server, then the .htaccess file detected and executed by the Apache server software. .htaccess files can be ... Read More

What is dependency injection in PHP?

Alok Prasad

Alok Prasad

Updated on 29-Jun-2020 11:54:40

Dependency injection is a procedure where one object supplies the dependencies of another object. Dependency Injection is a software design approach that allows avoiding hard-coding dependencies and makes it possible to change the dependencies both at runtime and compile time.There are numerous approaches to inject objects, here are couple generally ... Read More

Advertisements