We Guarantee the Best and Free technical solutions

Some Usefull link in this Application will redirect your mind to a new techical world

Admininterviewquestions in laravel

1. HTML line breaks in php

Ans: use <br> tag in php . For example echo <br>

2. exit in php

It terminate the execution.it is an alias for die construct.

3. How to turn off the errors in php

This is done by using display_errors in php.ini. we can turn off display_errors using this variable.Error reporting to browser is greater for development security.one disadavntage is it will show the directory path,filename,user name or even some times databse also.

4. What is array_keys().

array_keys() returns the key of its input array in the form of new array,where the keys are the stored value.
For Example:
$my_array=array('vasanthan'=>'myname',
'sudhina'=>'mywife',
'vivaan'=>'myson');
$new_array=array_keys($my_array);
print_r($new_array);
We will get the output as like below
Array
(
[0] => vasanthan
[1] => sudhina
[2] => vivaan
)

5. What is array_values().

array_values() returns the stored values from the original array.
For Example:
$my_array=array('vasanthan'=>'myname',
'sudhina'=>'mywife',
'vivaan'=>'myson');
$new_array=array_values($my_array);
print_r($new_array);
We will get the output as like below
Array
(
[0] => myname
[1] => mywife
[2] => myson
)

6. What is array_flip().

array_flip() changes the keys of an array into values.
For Example:
$my_array=array('vasanthan'=>'myname',
'sudhina'=>'mywife',
'vivaan'=>'myson');
$new_array=array_flip($my_array);
print_r($new_array);
We will get the output as like below
Array
(
[myname] => vasanthan
[mywife] => sudhina
[myson] => vivaan
)

7. What is array_reverse().

array_reverse() will change the array as in reverse order.
For Example:
$my_array=array('vasanthan'=>'myname',
'sudhina'=>'mywife',
'vivaan'=>'myson');
$new_array=array_flip($my_array);
print_r($new_array);
We will get the output as like below
Array
(
[vivaan] => myson
[sudhina] => mywife
[vasanthan] => myname
)

8. floor() in php

floor takes single argument and returns the largest integer that is less than or equal to the argument. For example :
floor(98.1),floor(98.9) will return the ouput as 98.

8. ceil() in php

ceil takes single argument and returns the smallest integer that is greater than or equal to the argument. For example :
floor(98.1),floor(98.9) will return the ouput as 99.

9. round() in php

round takes single argument and returns the nearest integer. if the fraction part is equal to 0.5 or above it will return the nearest high number otherwise nearest smallest number For example :
round(98.1)=98,round(98.5) =99

10. what is gethostbyname()

This is used to get the IP address corresponding to an internethostname
For Example
$ip=gethostbyname('www.mydoubts.in');
echo $ip;
if we use gethostnamel();-- here we will get the list of ip address correspnding to a given internet hostname.

11. in_array() in php

To check a value already in an array.
For Example
$values=array('banana','apple','pear','orange');
$search_value='orange';
syntax of checking whether a value exist in an array
if(in_array($search_value,$values))

12. range() function in php

To create an array of values as numbers
For Example
$my_array=range(1,7);
here the arguments 1 and 7 are the first and last values in the array
So if we print $my_array output will be as below
Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 )
if we create an array of letters using range function as follows
$letters=range(a,z);
so $letters will print the array values from A to Z.

13. What are the functions used to print two dimensional array

print_r(),var_dump()

14. Function used to add elements to the begining of an array

array_unshift();
For example
$my_array=array(2,3,4,5,6);
array_unshift($my_array,1);
if we print the new array using print_r statement first element will be 1 $my_array[0]=1;

15. Function used to add elements to the end of an array

array_push();
For example
$my_array=array(2,3,4,5,6);
$new_array=array_push($my_array,1);
if we print the new array using print_r statement first element will be 1 $new_array[5]=1;

16. Function used to remove the first elements from an array

array_shift();
For example
$my_array=array(2,3,4,5,6);
array_shift($my_array);
ouptput of print_r($my_array) as llike below
Array ( [0] => 3 [1] => 4 [2] => 5 [3] => 6 )

16. Function used to remove the last elements from an array

array_pop();
For example
$my_array=array(2,3,4,5,6);
array_pop($my_array);
ouptput of print_r($my_array) as llike below
Array ( [0] => 3 [1] => 4 [2] => 5 )

17. Function used to get the size of an array

array_count(); sizeof();
For example
$my_array=array(2,3,4,5,6);
$count=count($my_array); or sizeof($my_array); both will display the same result

18. Function used to get the size of an array

array_count(); sizeof();
For example
$my_array=array(2,3,4,5,6);
$count=count($my_array); or sizeof($my_array); both will display the same result

19. use of is_array() function

is_array() function takes single arguent and returns true if the element is an array.

20. Function used to convert a string to uppercase and lowercase

strtolower(),strtoupper().

21. abs() in php.

This function will return absolute(positive) value of a number
For Example
echo(abs(10.7))=10.7
echo(abs(-10.7)) =10.7
echo(abs(-5))=5
echo(abs(5))=5

22. max() and min() functions in php.

max() function will return highest value in a specified values or array.
min() function will return smallest value in a specified values or array.
Examples for max() function
echo(max(2,4,6,8,10))=10
echo(max(array(4,6,8,10))=10
Examples for min() function
echo(min(2,4,6,8,10))=2
echo(min(array(4,6,8,10))=4

23. use of current(),next(),prev(),end() in php.

For each function execution pointer will move to the corresponding key. For more understanding you can look into the following example
$my_array = array("Vasanthan", "Martin", "Manu", "Sathyan");
echo current($my_array)=Vasanthan
echo next($my_array)=Martin
echo current($my_array)=Martin
echo prev($my_array)=Vasanthan
echo rest($my_array)=Vasanthan

24. use of quotemeta() in php.

This function will add backslahses (/) infront of some predefined characters that have some meaning in mysql or unix.
Following are the predefined characters period (.)
backslash (\)
plus sign (+)
asterisk (*)
question mark (?)
brackets ([])
caret (^)
dollar sign ($)
parenthesis (())
For example
$mystring = "1 + 1 = 2";
echo quotemeta($mystring)=1 \+ 1 = 2

25. Use of addslahes() in php

addslashes() will add backslashes infront of predefined character. Following are the predefined characters
single quote (')
double quote (")
backslash (\)
NULL
These characters are typically need to remove from the database quries.

26. Use of stripslahes() in php

stripslahes() will remove the backslashes created by addslashes() function or existing backslashes in the saved data.actually this can be used to clean up the data received from the database.

27. Difference betwen ucfirst() and ucwords() in php

ucfirst() convert the first character of a first word to capital letter For Example
echo ucfirst("how are you vasanthan")=How are you vasanthan
ucwords() will convert first character of each word to capital letter.
For Exmple
echo ucwords("how are you vasanthan")=How Are You Vasanthan

28. explain chop(),rtrim(),ltrim(),trim()

chop() function removes whitespaces and some predefined characters from the right end of a string.
rtrim() function removes the whitespaces and some predefined characters from the right side of the string
l1trim() function removes the whitespaces and some predefined characters from the left side of the string
trim() functio will remove whitespaces and other predefined characters from both side of the string.

29. Explain the function str_repeat()

str_repeat() function will repeat the string to a specified number of times.
For example
echo (str_repeat("vasanthan",3)) = vasanthanvasanathanvasanthan

30. Which function will reverse a string in php

strrev() function will reverse a string.For Example
echo (strrev("vasanthan"))=nahtnasav

31. str_replace() in php

str_replace() function will replace some characters in a string with some ohter characters.For Example
$my_string="vasanthan";
str_replace('as','tp',$mystring)
above code will replace letter 'as' with 'tp'. Ouput will be looks like as below
vtpanthan

32. substr_replace() in php

substr_replace() function will replace part of the string with other string.For Example
echo (substr_replace("vasanthan","-",2,3))=va-than
here starting position is 2 and lenth of characters 3. it will replace 'san' to '-' in the string 'vasanthan'

33. purpose of fgetc() function in php

function used to read single character from a file

34. wordwrap() function in php

wraps a string into given number of characters.
Syntax:
wordwrap(string $str,int $width,string $break,bool $cut);
wordwrap($text,8,"\n",true);

35. What are the various methods to post data from one webpage to another web page

Post,Get,Session,Cookies,Querystring.