Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #8523

Re: Novice Question

Message-ID <7592184.1qVRdKLYnM@PointedEars.de> (permalink)
From Thomas 'PointedEars' Lahn <PointedEars@web.de>
Organization PointedEars Software (PES)
Date 2013-03-04 01:52 +0100
Subject Re: Novice Question
Newsgroups comp.lang.php
References <c7f12a71-9e2b-4296-a0c6-27e014fb1d22@9g2000yqy.googlegroups.com> <kh0mrc$9g2$1@dont-email.me>

Show all headers | View raw


Gregor Kofler wrote:

> Am 03.03.2013 23:10, David Heller meinte:
>> I'm doing some maintenance/upgrade of some old php4.3 code and I ran
>> across the following code snippet:
>> $gvns = (array)$gvns;
>> What it exactly is happening here? what does (array) mean?
>> never seen anything like this before.
> 
> Type casting.

ACK.

> (It's the same as $gvns = array($gvns); )

Evidently it is not.

$ php -r 'class C {}; print_r((array) new C()); print_r(array(new C()));'
Array
(
)
Array
(
    [0] => C Object
        (
        )

)
 

PointedEars
-- 
    realism:    HTML 4.01 Strict
    evangelism: XHTML 1.0 Strict
    madness:    XHTML 1.1 as application/xhtml+xml
                                                    -- Bjoern Hoehrmann

Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Novice Question David Heller <daveh@allheller.net> - 2013-03-03 14:10 -0800
  Re: Novice Question Gregor Kofler <usenet@gregorkofler.com> - 2013-03-04 00:38 +0100
    Re: Novice Question Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-04 01:52 +0100
      Re: Novice Question Gregor Kofler <usenet@gregorkofler.com> - 2013-03-04 23:12 +0100
  Re: Novice Question Captain Paralytic <paul_lautman@yahoo.com> - 2013-03-04 02:31 -0800

csiph-web