php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68919 the binary cast returns string
Submitted: 2015-01-27 12:34 UTC Modified: 2015-01-27 12:58 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: wallacemaxters at gmail dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.4.37 OS: Windows 7
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: wallacemaxters at gmail dot com
New email:
PHP Version: OS:

 

 [2015-01-27 12:34 UTC] wallacemaxters at gmail dot com
Description:
------------
I'm having trouble using the Binary Cast.

When I try to use the Cast to convert a string (or any other amount) in binary, the result is always the initial.

Even used the example of this page:
http://php.net/manual/pt_BR/language.types.type-juggling.php

And nothing worked as it should.

I did the tests both in 5.14.17 PHP as of PHP 5.6. The results were the same.

Test script:
---------------
<?php

$string = "My Simple String";

var_dump((binary) $string; // string(16) "My Simple String"



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-01-27 12:58 UTC] nikic@php.net
-Status: Open +Status: Not a bug
 [2015-01-27 12:58 UTC] nikic@php.net
(binary) is a forward-compatibility token for the now abandoned PHP 6. It behaves the same way as doing a (string) cast in PHP 5.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 02:01:31 2024 UTC