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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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: Wed Oct 07 17:00:02 2026 UTC