[PHP] Class Static variables in double quoted string or heredoc

2008-04-25 Thread Leurent Francois
Is there any hope that
echo "Welcome {session::$user_info['user_name']}";

will work someday, if not, is there a simple reason i'm missing ? 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Class Static variables in double quoted string or heredoc

2008-04-25 Thread Leurent Francois
I like  the sess::reload() and sess::connect($user_login,$user_pswd); 
idea...


> is there a reason why that would work better then: echo "Welcome 
> {$_SESSION['user_info']['user_name']}";?
>
> Just curious :)
>
> --
>
> Jason Pruim
> Raoset Inc.
> Technology Manager
> MQC Specialist
> 3251 132nd ave
> Holland, MI, 49424-9337
> www.raoset.com
> [EMAIL PROTECTED]
>
>
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Class & Type Casting

2008-06-10 Thread Leurent Francois
I was asking myself if there was a good reason this syntax not to work

class string_extented{
function __construct($str){
$this->contents=$str;
}
function __toString(){
return $this->contents;
}

}

//that's working fine
$test= new string_extended("this is my anonymous string");
echo $test;


/that's not working, but should'nt it be the case ?
$test = (string_extended) "This is my anonymous string";
echo $test;

I'll find this very usefull :x, it's just a syntax ehancement nope ?




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Class & Type Casting

2008-06-11 Thread Leurent Francois
> One could ask if it would just pass to
> the constructor, but it doesn't.  I don't know if there's a technical 
> reason
> for that or if just no one implemented it, but the short answer is "The
> language doesn't do that."

That's what i was asking about, when trying to "cast" something into a non 
native type ( ie a class ), just fire the constructor. Would'nt it be great 
?

$myvar=(array) somefunc();
$myvar=(myarrayextented) somefunc();

( what should be exactly the same as  )
$myvar=new myarrayextented(somefunc());

But with a lot more of coolness ! 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: __toString & friends

2008-09-19 Thread Leurent Francois
Is there any feature submission  process were we could discuss of this 
subject ?


"Colin Guthrie" <[EMAIL PROTECTED]> a écrit dans le message de news: 
[EMAIL PROTECTED]
> Nathan Rixham wrote:
>> concurred; I recently made a class that turn's all objects into XML; and 
>> implented it in my __toString()'s :)
>
> In that case rather than __toBool() __toInt() etc. it should really 
> support a magic __cast() method or similar.
>
> This method would contain a single argument that represents the type (e.g. 
> a class name or a builtin type
>
> function __cast($type)
> {
>   switch ($type)
>   {
> case 'string':
>   return 'Foo';
> case 'array':
>   return array('Foo');
> case 'DomDocument':
>   // etc.
>   }
> }
>
> And if you did:
>
> $foo = new MyClass;
>
> $xml = (DomDocument)$foo;
>
> It would return the result of __cast called with $type == 'DomDocument'.
>
> That would be nice and generic.
>
> I could see that being quite useful (tho' arguably, itmplementing a cast() 
> method is not that hard:
>
> $xml = $foo->cast('DomDocument');
>
> It's not as neat tho' :)
>
> col
>
> -- 
>
> Colin Guthrie
> gmane(at)colin.guthr.ie
> http://colin.guthr.ie/
>
> Day Job:
>   Tribalogic Limited [http://www.tribalogic.net/]
> Open Source:
>   Mandriva Linux Contributor [http://www.mandriva.com/]
>   PulseAudio Hacker [http://www.pulseaudio.org/]
>   Trac Hacker [http://trac.edgewall.org/]
> 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Re: __toString & friends

2008-09-19 Thread Leurent Francois
thx  Thiago .
I suggested there
  http://bugs.php.net/bug.php?id=46128



""Thiago H. Pojda"" <[EMAIL PROTECTED]> a écrit dans le message de 
news: [EMAIL PROTECTED]
http://bugs.php.net should help you out.

In the bug reporting page there's a Feature request item (It's the 3rd item
in the Type of bug select).

Btw, I liked this idea :)

On Fri, Sep 19, 2008 at 8:58 AM, Leurent Francois 
<[EMAIL PROTECTED]>wrote:

> Is there any feature submission  process were we could discuss of this
> subject ?
>
>
> "Colin Guthrie" <[EMAIL PROTECTED]> a écrit dans le message de news:
> [EMAIL PROTECTED]
> > Nathan Rixham wrote:
> >> concurred; I recently made a class that turn's all objects into XML; 
> >> and
> >> implented it in my __toString()'s :)
> >
> > In that case rather than __toBool() __toInt() etc. it should really
> > support a magic __cast() method or similar.
> >
> > This method would contain a single argument that represents the type
> (e.g.
> > a class name or a builtin type
> >
> > function __cast($type)
> > {
> >   switch ($type)
> >   {
> > case 'string':
> >   return 'Foo';
> > case 'array':
> >   return array('Foo');
> > case 'DomDocument':
> >   // etc.
> >   }
> > }
> >
> > And if you did:
> >
> > $foo = new MyClass;
> >
> > $xml = (DomDocument)$foo;
> >
> > It would return the result of __cast called with $type == 'DomDocument'.
> >
> > That would be nice and generic.
> >
> > I could see that being quite useful (tho' arguably, itmplementing a
> cast()
> > method is not that hard:
> >
> > $xml = $foo->cast('DomDocument');
> >
> > It's not as neat tho' :)
> >
> > col
> >
> > --
> >
> > Colin Guthrie
> > gmane(at)colin.guthr.ie
> > http://colin.guthr.ie/
> >
> > Day Job:
> >   Tribalogic Limited [http://www.tribalogic.net/]
> > Open Source:
> >   Mandriva Linux Contributor [http://www.mandriva.com/]
> >   PulseAudio Hacker [http://www.pulseaudio.org/]
> >   Trac Hacker [http://trac.edgewall.org/]
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Thiago Henrique Pojda



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php