DEV Community

Cover image for Advance Laravel 8 Interview Questions and Answers 2022
Ashish Yadav
Ashish Yadav

Posted on

Advance Laravel 8 Interview Questions and Answers 2022

Q. 1: What is Serialization in Laravel?

It's similar to turning an object into JSON, but with the advantage that PHP will remember the native data type of each serialized item (string, array, integer, float, boolean).

PHP and Javascript can only communicate via strings. You can pass the string "foo" very easily to Javascript. You can pass the number 1 very easily to Javascript. You can pass the boolean values true and false easily to Javascript. But how do you pass this array to Javascript?

The answer is serialization. In case of PHP/Javascript, JSON is actually the better serialization format:

**echo json_encode($array)

Read Full Blog Here....

Top comments (1)

Collapse
 
sloan profile image
Sloan the DEV Moderator

Hi there, we encourage authors to share their entire posts here on DEV, rather than mostly pointing to an external link. Doing so helps ensure that readers don’t have to jump around to too many different pages, and it helps focus the conversation right here in the comments section.

If you choose to do so, you also have the option to add a canonical URL directly to your post.