Intermediate
PHP
Q90 / 100
What is the PHP serialize() vs json_encode() for data persistence?
Correct! Well done.
Incorrect.
The correct answer is B) serialize() is PHP-specific and handles objects with __sleep/__wakeup; json_encode() produces portable JSON but loses object class info
B
Correct Answer
serialize() is PHP-specific and handles objects with __sleep/__wakeup; json_encode() produces portable JSON but loses object class info
Explanation
serialize() preserves PHP objects (class name + state) for PHP-to-PHP transfer. json_encode() is portable, human-readable, but loses PHP class information.
Progress
90/100