php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68233 gettype doesn`t get the type of parsable string created by var_export
Submitted: 2014-10-15 11:47 UTC Modified: 2014-10-15 16:57 UTC
From: mohit dot cse07 at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.5.17 OS: LINUX
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: mohit dot cse07 at gmail dot com
New email:
PHP Version: OS:

 

 [2014-10-15 11:47 UTC] mohit dot cse07 at gmail dot com
Description:
------------
I need to check the type of variable before proceeding my next operation, for this i used "gettype".
But it output as NULL, expected to return as String.

NOTE : I have also used var_export to change the type into parsable string.

Please check if it is a bug or i`m doing something wrong.

Thank you
regards
Mohit

Test script:
---------------
<?php
$testArray = array(1,2,'mohit');
$parsableString = var_export($testArray);
echo gettype($parsableString);
?>

Expected result:
----------------
string

Actual result:
--------------
NULL

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-15 16:57 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2014-10-15 16:57 UTC] nikic@php.net
var_export by default writes the exported string to stdout. If you want it to return the string instead, pass true as the second argument. See also http://php.net/var_export.
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Thu Oct 08 02:00:01 2026 UTC