RE: [PHP] How do I convert the string "E_ALL & ~E_NOTICE" to the decimal equivalent 6135?
| From: | Ford, Mike | Date: | Fri, 12 Nov 2010 11:28:50 +0000 |
| Subject: | RE: [PHP] How do I convert the string "E_ALL & ~E_NOTICE" to the decimal equivalent 6135? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-309472@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Daevid Vincent [mailto:daevid@daevid.com]
> Sent: 11 November 2010 22:23
> To: php-general@lists.php.net
>
> > -----Original Message-----
> > From: Ford, Mike [mailto:M.Ford@leedsmet.ac.uk]
> > Sent: Thursday, November 11, 2010 12:58 AM
> > To: php-general@lists.php.net
> > Subject: RE: [PHP] How do I convert the string "E_ALL &
> > ~E_NOTICE" to the decimal equivalent 6135?
> >
> > > -----Original Message-----
> > > From: Daevid Vincent [mailto:daevid@daevid.com]
> > > Sent: 11 November 2010 04:06
> > > To: php-general@lists.php.net
> > >
> > > We're trying to move all of our configuration files for our
> > > DEV/TEST/PROD
> > > and various python scripts and such that all need the same DB
> > > connection
> > > parameters and pathing information to a common and simple
> config.ini
> > > file
> > > they all can share across languages.
> > >
> > > One snag I ran into is this:
> > >
> > > [dart]
> > > relative_url = /dart2
> > > absolute_path = /home/www/dart2
> > > log_level = E_ALL & ~E_NOTICE
> > >
> > > But when I read it in from the file, it's a string (of course)
> >
> > That's odd -- parse_ini_file() should definitely translate
> > those constants!
> > It certainly works on my v5.2.5 installation.
> >
> > Cheers!
> >
> > Mike
>
> You assume I'm using that busted-ass "parse_ini_file()" function. ;-
> )
>
> See previous emails as to why that's a useless option for me.
>
> I wrote a much better parser which I'll post in another email.
Ah, I see. I don't believe you mentioned that in your original query.
In that case, your only option probably is eval - something like:
eval("\$log_level_int = {$log_level_string}");
or:
$log_level_int = eval("return {$log_level_string}");
Cheers!
Mike
--
Mike Ford,
Electronic Information Developer, Libraries and Learning Innovation,
Leeds Metropolitan University, C507 City Campus,
Woodhouse Lane, LEEDS, LS1 3HE, United Kingdom
Email: m.ford@leedsmet.ac.uk
Tel: +44 113 812 4730
To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm