php-general Digest 27 Feb 2009 14:10:57 -0000 Issue 5982

Topics (messages 288894 through 288917):

How do I remove an array element from within a recursive function?
        288894 by: Daevid Vincent
        288895 by: Shawn McKenzie
        288896 by: Shawn McKenzie
        288897 by: Daevid Vincent
        288898 by: Chris

Re: verify text in field
        288899 by: PJ
        288902 by: David Robley

Re: catch the error
        288900 by: 9el
        288917 by: Boyd, Todd M.

Stop Being a Wage Slave! Join EarnGoogleCash Program!
        288901 by: Julianne Carbaugh

Stupid is as Stupid does
        288903 by: Michael A. Peters
        288905 by: Ondrej Kulaty
        288906 by: Sudheer

Re: "use strict" or similar in PHP?
        288904 by: Per Jessen
        288907 by: Hans Schultz
        288908 by: 9el
        288910 by: Michael A. Peters
        288912 by: Hans Schultz
        288913 by: Ashley Sheridan
        288914 by: Hans Schultz
        288915 by: Robert Cummings
        288916 by: Bob McConnell

Make Money From Your Home Using Internet
        288909 by: Roly Cross

Weird spam messages on the list...  [WAS: Stop Being a Wage Slave! Join 
EarnGoogleCash Program!]
        288911 by: Michelle Konzack

Administrivia:

To subscribe to the digest, e-mail:
        php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
        php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
        php-gene...@lists.php.net


----------------------------------------------------------------------
--- Begin Message ---
I have an array like this and I simply need to recurse over it and find
a matching "menu" item to remove:

array(3) {

 ["dart"]=>
  array(10) {
    [0]=>
    object(menuItem)#4 (9) {
      ["menu"]=>
      string(7) "My DART"
      ["name"]=>
      string(7) "My DART"
      ["title"]=>
      string(39) "Data Analasys & Reliability Tracker"
      ["employee_only"]=>
      bool(false)
      ["page"]=>
      NULL
      ["children"]=>
      NULL
      ["parent"]=>
      NULL
      ["current"]=>
      bool(false)
      ["array_key"]=>
      string(4) "dart"
    }
    [1]=>
    object(menuItem)#5 (9) {
      ["menu"]=>
      string(5) "Login"
      ["name"]=>
      string(5) "Login"
      ["title"]=>
      string(5) "Login"
      ["employee_only"]=>
      bool(false)
      ["page"]=>
      string(9) "login.php"
      ["children"]=>
      NULL
      ["parent"]=>
      NULL
      ["current"]=>
      bool(false)
      ["array_key"]=>
      string(4) "dart"
    }
    [2]=>
    object(menuItem)#6 (9) {
      ["menu"]=>
      string(13) "Lost Password"
      ["name"]=>
      string(13) "Lost Password"
      ["title"]=>
      string(13) "Lost Password"
      ["employee_only"]=>
      bool(false)
      ["page"]=>
      string(12) "forgotpw.php"
      ["children"]=>
      NULL
      ["parent"]=>
      NULL
      ["current"]=>
      bool(false)
      ["array_key"]=>
      string(4) "dart"
    }
...

I'm trying to remove ["menu"] == 'Login' from the array, but despite "finding" 
the element, it never removes.
isn't that what the & reference stuff is for?

menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password'));


        public static final function removeMenuItems(&$menuItems, $removeArray)
        {
                foreach($menuItems as $value)
                {
                        if (is_array($value->children))
                                menuItem::removeMenuItems(&$value->children, 
$removeArray);
                        else
                        {
                                //echo "*** CHECKING ".$value->menu." against 
".implode(',',$removeArray)." ***";
                                if (in_array($value->menu, $removeArray))
                                {
                                        //echo "*** REMOVING ".$value->menu." 
***";
                                        unset($value);
                                }
                        }
                }
        }

--- End Message ---
--- Begin Message ---
Daevid Vincent wrote:
 > I'm trying to remove ["menu"] == 'Login' from the array, but despite
"finding" the element, it never removes.
> isn't that what the & reference stuff is for?

Yes, but foreach can't modify an array unless you use a reference in the
foreach also.  Try this:

foreach($menuItems as &$value)


> 
> menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password'));
> 
> 
>       public static final function removeMenuItems(&$menuItems, $removeArray)
>       {
>               foreach($menuItems as $value)
>               {
>                       if (is_array($value->children))
>                               menuItem::removeMenuItems(&$value->children, 
> $removeArray);
>                       else
>                       {
>                               //echo "*** CHECKING ".$value->menu." against 
> ".implode(',',$removeArray)." ***";
>                               if (in_array($value->menu, $removeArray))
>                               {
>                                       //echo "*** REMOVING ".$value->menu." 
> ***";
>                                       unset($value);
>                               }
>                       }
>               }
>       }
> 


-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
Shawn McKenzie wrote:
> Daevid Vincent wrote:
>  > I'm trying to remove ["menu"] == 'Login' from the array, but despite
> "finding" the element, it never removes.
>> isn't that what the & reference stuff is for?
> 
> Yes, but foreach can't modify an array unless you use a reference in the
> foreach also.  Try this:
> 
> foreach($menuItems as &$value)
> 
> 
>> menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost 
>> Password'));
>>
>>
>>      public static final function removeMenuItems(&$menuItems, $removeArray)
>>      {
>>              foreach($menuItems as $value)
>>              {
>>                      if (is_array($value->children))
>>                              menuItem::removeMenuItems(&$value->children, 
>> $removeArray);
>>                      else
>>                      {
>>                              //echo "*** CHECKING ".$value->menu." against 
>> ".implode(',',$removeArray)." ***";
>>                              if (in_array($value->menu, $removeArray))
>>                              {
>>                                      //echo "*** REMOVING ".$value->menu." 
>> ***";
>>                                      unset($value);
>>                              }
>>                      }
>>              }
>>      }
>>
> 
> 

Also, I'm not sure what happens here:

if (is_array($value->children))
        menuItem::removeMenuItems(&$value->children, $removeArray);
else
{

Your function defines that var as a reference so you don't have to use a
reference in the call.  Don't know if it does anything but throw a
deprecated notice though.

-- 
Thanks!
-Shawn
http://www.spidean.com

--- End Message ---
--- Begin Message ---
I tried that and it still doesn't work. I even tried this hardcore
"test":

public static final function removeMenuItems(&$menuItems, $removeArray)
{
    foreach($menuItems as &$value)
    {
        unset($value);
    }
}


-----Original Message-----
From: Shawn McKenzie <nos...@mckenzies.net>
To: php-gene...@lists.php.net
Subject: [PHP] Re: How do I remove an array element from within a
recursive function?
Date: Thu, 26 Feb 2009 20:10:20 -0600


Daevid Vincent wrote:
 > I'm trying to remove ["menu"] == 'Login' from the array, but despite
"finding" the element, it never removes.
> isn't that what the & reference stuff is for?

Yes, but foreach can't modify an array unless you use a reference in the
foreach also.  Try this:

foreach($menuItems as &$value)


> 
> menuItem::removeMenuItems($navArray['dart'], array('Login', 'Lost Password'));
> 
> 
>       public static final function removeMenuItems(&$menuItems, $removeArray)
>       {
>               foreach($menuItems as $value)
>               {
>                       if (is_array($value->children))
>                               menuItem::removeMenuItems(&$value->children, 
> $removeArray);
>                       else
>                       {
>                               //echo "*** CHECKING ".$value->menu." against 
> ".implode(',',$removeArray)." ***";
>                               if (in_array($value->menu, $removeArray))
>                               {
>                                       //echo "*** REMOVING ".$value->menu." 
> ***";
>                                       unset($value);
>                               }
>                       }
>               }
>       }
> 


-- 
Thanks!
-Shawn
http://www.spidean.com




--- End Message ---
--- Begin Message ---
Daevid Vincent wrote:
I tried that and it still doesn't work. I even tried this hardcore
"test":

public static final function removeMenuItems(&$menuItems, $removeArray)
{
    foreach($menuItems as &$value)
    {
        unset($value);
    }
}

You don't unset the value, you unset the key.

<?php

$items = array('menu1', 'menu2', 'menu3');

echo "Before:\n";
print_r($items);

foreach ($items as $_menuKey => $value) {
        if ($value == 'menu2') {
                unset($items[$_menuKey]);
        }
}

echo "After:\n";
print_r($items);


$ php test.php
Before:
Array
(
    [0] => menu1
    [1] => menu2
    [2] => menu3
)
After:
Array
(
    [0] => menu1
    [2] => menu3
)

--
Postgresql & php tutorials
http://www.designmagick.com/


--- End Message ---
--- Begin Message ---
ad...@buskirkgraphics.com wrote:
> Try
> $text = "Joe of Egypt";
> $sql = "SELECT title FROM book WHERE title LIKE '$text'";
> $result = mysql_query($sql);
> If(mysql_num_rows($result) >= '1')
> {
> while ( $row = mysql_fetch_array($sql) ) {
> echo("<P>" . $row["title"] . "</P>");
> }
> }
>
> My Ideas my not make some people happy with my design but I use it and it
> works very well
>
>
>
> -----Original Message-----
> From: PJ [mailto:af.gour...@videotron.ca]
> Sent: Thursday, February 26, 2009 5:07 PM
> To: php-gene...@lists.php.net
> Subject: [PHP] verify text in field
>
> Is there a shorter way of determining if a field contains text?
> This works but I wonder if I can K.I.S.S. it? I really only need to know
> if there is or is not a field containing the text specified. I don't
> need to see it.
> <?php
>
> // Request the text
> $text = "Joe of Egypt";
> $sql = "SELECT title FROM book WHERE title LIKE '$text'";
> $result = mysql_query($sql);
> if (!$result) {
> echo("<P>Error performing query: " .
> mysql_error() . "</P>");
> exit();
> }
>
> // Display the text
> while ( $row = mysql_fetch_array($result) ) {
> echo("<P>" . $row["title"] . "</P>");
> }
> if ($row["title"] == "")
> echo ("Empty!")
>
> ?>
>
I think I was not precise in my question.
I meant that I do need to be able to use an if condition to determine
which instruction will be executed next: e.g. if the $return is ""(empty
or 0) then I INSERT data somewhere; if the $return is a string or text
or 1, then I either do a different insert or I abort the operation and
ask to restart it with different criteria.
I was just wondering if there was conditional operation I could use that
would replace this:
=============
if (!$result) {
echo("<P>Error performing query: " .
mysql_error() . "</P>");
exit();
}
// Display the text
while ( $row = mysql_fetch_array($result) ) {
echo("<P>" . $row["title"] . "</P>");
}
if ($row["title"] == "")
echo ("Empty!")
============
-- 

Phil Jourdan --- p...@ptahhotep.com
http://www.ptahhotep.com
http://www.chiccantine.com

--- End Message ---
--- Begin Message ---
PJ wrote:

> Is there a shorter way of determining if a field contains text?
> This works but I wonder if I can K.I.S.S. it? I really only need to know
> if there is or is not a field containing the text specified. I don't
> need to see it.
> <?php
>  
>   // Request the text
>   $text = "Joe of Egypt";
>   $sql = "SELECT title FROM book WHERE title LIKE '$text'";
>   $result = mysql_query($sql);
>   if (!$result) {
>     echo("<P>Error performing query: " .
>          mysql_error() . "</P>");
>     exit();
>   }
> 
>   // Display the text
>   while ( $row = mysql_fetch_array($result) ) {
>     echo("<P>" . $row["title"] . "</P>");
>   }
>   if ($row["title"] == "")
>       echo ("Empty!")
> 
> ?>
> 

In addition to other answers, don't forget to escape the string you are
passing to the query with mysql_real_escape_string(), otherwise your query
will have problems with some characters e.g. apostrophe.


Cheers
-- 
David Robley

"I refuse to make an agenda," Tom said listlessly.
Today is Pungenday, the 58th day of Chaos in the YOLD 3175. 


--- End Message ---
--- Begin Message ---
PJ you should be getting Warning errors the way you had the code.

You definitely is a fun lover and enjoy moments. But while coding dont only
think of fastness of coding but also code with logic.

I was going to answer you about the $db but later I found lots response
already came so didn't really dig to get the errors. Look back, see, I asked
if you got rid of the errors :)

Now, if you dont use the  variable in the parameter it will look for the
immediate opened database resource but if you use a variable..... THEN it
must contain that required resource thats just OBVIOUS reason. And, your
error reporting should be reporting that. I haven't checked the code. A
funny thing is you are making others think for the things you should be
thinking. I dont say its bad. Its actually good for all of us having some
drill on the basics :D

Regards

Lenin

www.twitter.com/nine_L
www.lenin9l.wordpress.com

On Fri, Feb 27, 2009 at 6:37 AM, Chris <dmag...@gmail.com> wrote:

> Boyd, Todd M. wrote:
>
>> -----Original Message-----
>>> From: Chris [mailto:dmag...@gmail.com]
>>> Sent: Thursday, February 26, 2009 4:16 PM
>>> To: Boyd, Todd M.
>>> Cc: PJ; PHP General list
>>> Subject: Re: [PHP] Re: catch the error
>>>
>>>
>>>  In examples sent to you, people foolishly replaced your $db var with
>>>> $db_connect ONLY FOR PART OF THE SCRIPT. You've defined your
>>>>
>>> database
>>
>>> connection as $db_connect in some versions of the source, but then
>>>>
>>> you
>>>
>>>> reference $db (without _connect) in your mysql_select call in that
>>>>
>>> same
>>>
>>>> source.
>>>>
>>>> $db = mysql_connect([option list here]); # <-- this code
>>>>
>>> instantiates
>>
>>> a
>>>
>>>> connection
>>>> mysql_select_db([some name], $db); # notice how $db is here?
>>>> $result = mysql_query([some query], $db); # it's here, too!
>>>>
>>>> $db becomes your resource link when you use mysql_connect. That
>>>>
>>> resource
>>>
>>>> link must then be passed to your mysql functions. Otherwise, they
>>>>
>>> have
>>>
>>>> no idea which database connection you are attempting to use.
>>>>
>>> RTFM?
>>>
>>> If no connection is specified, the last one is used.
>>>
>>> It is an optional argument (only *really* needed when you have
>>>
>> multiple
>>
>>> connections in the same script).
>>>
>>
>> RTF E-mail I sent?
>>
>> He had used $db_connect instead of $db. $db_connect hadn't been set to
>> anything. He was specifying a connection, but it was null. Unless it
>> falls back to the last connection used in the case of an empty variable,
>> then this was most likely (read: proven to be) the problem.
>>
>
> The last two emails I saw (no I haven't read the whole thread) were:
>
> >> $db = mysql_connect($db_host, $db_user, $db_pass);
> >> > >> mysql_select_db($db_name,$db);
>
> <snip>
>
> >> > >> $result1 = mysql_query($sql1,$db);
>
> and
>
> > $db = mysql_connect($db_host, $db_user, $db_pass);
> > mysql_select_db($db_name,$db);
>
> which have the right variables.
>
> Plus I was picking on the "you must do this" - using the link identifier is
> an optional thing as I already said.
>
> --
> Postgresql & php tutorials
> http://www.designmagick.com/
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
> -----Original Message-----
> From: Chris [mailto:dmag...@gmail.com]
> Sent: Thursday, February 26, 2009 6:38 PM
> To: Boyd, Todd M.
> Cc: PHP General list
> Subject: Re: [PHP] Re: catch the error
> 
> Boyd, Todd M. wrote:
> >> -----Original Message-----
> >> From: Chris [mailto:dmag...@gmail.com]
> >> Sent: Thursday, February 26, 2009 4:16 PM
> >> To: Boyd, Todd M.
> >> Cc: PJ; PHP General list
> >> Subject: Re: [PHP] Re: catch the error
> >>
> >>
> >>> In examples sent to you, people foolishly replaced your $db var
> with
> >>> $db_connect ONLY FOR PART OF THE SCRIPT. You've defined your
> > database
> >>> connection as $db_connect in some versions of the source, but then
> >> you
> >>> reference $db (without _connect) in your mysql_select call in that
> >> same
> >>> source.
> >>>
> >>> $db = mysql_connect([option list here]); # <-- this code
> > instantiates
> >> a
> >>> connection
> >>> mysql_select_db([some name], $db); # notice how $db is here?
> >>> $result = mysql_query([some query], $db); # it's here, too!
> >>>
> >>> $db becomes your resource link when you use mysql_connect. That
> >> resource
> >>> link must then be passed to your mysql functions. Otherwise, they
> >> have
> >>> no idea which database connection you are attempting to use.
> >> RTFM?
> >>
> >> If no connection is specified, the last one is used.
> >>
> >> It is an optional argument (only *really* needed when you have
> > multiple
> >> connections in the same script).
> >
> > RTF E-mail I sent?
> >
> > He had used $db_connect instead of $db. $db_connect hadn't been set
> to
> > anything. He was specifying a connection, but it was null. Unless it
> > falls back to the last connection used in the case of an empty
> variable,
> > then this was most likely (read: proven to be) the problem.
> 
> The last two emails I saw (no I haven't read the whole thread) were:
> 
>  >> $db = mysql_connect($db_host, $db_user, $db_pass);
>  >> > >> mysql_select_db($db_name,$db);
> 
> <snip>
> 
>  >> > >> $result1 = mysql_query($sql1,$db);
> 
> and
> 
>  > $db = mysql_connect($db_host, $db_user, $db_pass);
>  > mysql_select_db($db_name,$db);
> 
> which have the right variables.
> 
> Plus I was picking on the "you must do this" - using the link
> identifier
> is an optional thing as I already said.

Yes, it was solved before I replied. I just wanted to point out why it
worked in the situations that it did and why it did not work in the
situations that it did not. As the OP had been staring at it for too
long, all of the code started to blur together. :)

Anyway, it's a moot point now. I think the information you provided
about the link identifier was solid advice... I was just trying to point
out that using two different variables when specifying the link
identifier in mysql functions was what gave him so much guff.


// Todd

--- End Message ---
--- Begin Message ---
Hi!

Do you Know That Much Money is Being Spent Online Nowadays? Now is the Right 
Time to Get a Piece of It!

Are you wondering how people make money through the Internet by doing almost 
nothing? At first, I was wary about working from home, because I had heard 
horror stories about the Internet. But I'd heard that there were rounds of 
layoffs coming at my company, so I figured I should do something to try and 
have a backup should the worst happen. 

I was amazed when I got this Free-Trial Kit. It started working right away. By 
the time the layoffs happened, I was already making more money from Google than 
I was in my job. Now I use Google full time and have a great income.

Unfortunately, I cannot send this offer to everyone to prevent the value and 
potency of this information from being "watered down". That's why I am sending 
this email only to people I know and care about. A friend of mine gave me your 
email address, that's why I decided to send that offer to you too(I am sorry if 
I disturbed you in anyway).

If you are interested to participate in this program, send an answer to 
dipietrantoni.hurley1...@gmail.com, saying that you want to join too, so you 
can receive your Risk-Free Kit and start enjoying a life free from money 
worries for the rest of your life!

Regards,
a trusted Friend











------------------------------------------------------------------
This email has been written and proved to be in compliance with the recently 
established can-spam act law in US. We are not provoking or forcing any person 
in any way to participate in our programs. To participate is your own decision 
and you carry the responsibility of taking further part in this promotion. 
Anyway, if you don't want to receive more good offers from us, you can simply 
Unsubscribe by sending us a notification email to get.out_of_the_l...@yahoo.com 
with a mail-subject and text "Unsubscribe me", and we will get your email out 
of our list within 10 days.

This message is STRICTLY CONFIDENTIAL and is solely for the individual or 
organisation to whom it is addressed. It may contain PRIVILEGED and 
CONFIDENTIAL information. If you are not the intended recipient, you are hereby 
notified that any dissemination, distribution or copying of this communication 
and its contents is strictly prohibited. If you are not interested in the 
offered promotions, please just don't answer. If you think you have received 
this message and its contents in error, please delete it from your computer, or 
follow the unsubscribing procedure shown above.
------------------------------------------------------------------
                

--- End Message ---
--- Begin Message --- As my web app is coming to completion, I added a means to search records (different from site search).

This involves reading post input and is many cases converting it to an integer.

Damn I feel dumb.

The search app wasn't working, so I did what I often do when troubleshooting crap - I put a die($variable) at various points to see if the variable is what it is suppose to be.

I kept getting blank returns from die after the conversion from a post string to an integer. I looked in the apache logs, system logs, I even tried rebooting - I couldn't figure why the smurf the variable wasn't converting to integer.

I even turned off eaccelerator in case that was causing it, though it never has given me issue before (except once when I was doing something in a really shoddy way - cleaned up my method and it behaved)

After several hours contemplating if I had bad RAM, an issue with the CPU, verifying my RPMs were good, wondering why I wasn't getting anything in the logs, it dawned on me.

If variable is an integer, die($var) returns nothing and is suppose to return nothing, it takes a string as an argument to echo on death - die("$var") is what I wanted.

I need sleep.

I did finally find the error and fix the record search problem.

--- End Message ---
--- Begin Message ---
Use var_dump() to see contents of a variable. It will print something even 
if variable is empty or undefined.

""Michael A. Peters"" <mpet...@mac.com> píse v diskusním príspevku 
news:49a79416.6060...@mac.com...
> As my web app is coming to completion, I added a means to search records 
> (different from site search).
>
> This involves reading post input and is many cases converting it to an 
> integer.
>
> Damn I feel dumb.
>
> The search app wasn't working, so I did what I often do when 
> troubleshooting crap - I put a die($variable) at various points to see if 
> the variable is what it is suppose to be.
>
> I kept getting blank returns from die after the conversion from a post 
> string to an integer. I looked in the apache logs, system logs, I even 
> tried rebooting - I couldn't figure why the smurf the variable wasn't 
> converting to integer.
>
> I even turned off eaccelerator in case that was causing it, though it 
> never has given me issue before (except once when I was doing something in 
> a really shoddy way - cleaned up my method and it behaved)
>
> After several hours contemplating if I had bad RAM, an issue with the CPU, 
> verifying my RPMs were good, wondering why I wasn't getting anything in 
> the logs, it dawned on me.
>
> If variable is an integer, die($var) returns nothing and is suppose to 
> return nothing, it takes a string as an argument to echo on death - 
> die("$var") is what I wanted.
>
> I need sleep.
>
> I did finally find the error and fix the record search problem. 



--- End Message ---
--- Begin Message ---
Michael A. Peters wrote:

If variable is an integer, die($var) returns nothing and is suppose to return nothing, it takes a string as an argument to echo on death - die("$var") is what I wanted.
I often use
<?php
var_dump($myVar); exit(1);
?>

to debug and print the value of the variable. xDebug adds nice formatting to var_dump().

--

With warm regards,
Sudheer. S
Business: http://binaryvibes.co.in, Tech stuff: http://techchorus.net, 
Personal: http://sudheer.net


--- End Message ---
--- Begin Message ---
Hans Schultz wrote:

> Is there some way for PHP to cache some data on the page? I like very
> much PHP's speed but it would be even better to be able to cache some
> frequently used data from database?

Databases such as MySQL are very good at caching. 



-- 
Per Jessen, Zürich (3.6°C)


--- End Message ---
--- Begin Message --- On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie <nos...@mckenzies.net> wrote:


There is no "compile" time.  PHP is interpreted so it is compiled and
then executed.

If you always want error reporting, then set it in php.ini.


It is compiled in no time, so there is no compile time?
LOL

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--- End Message ---
--- Begin Message ---
-----------------------------------------------------------------------
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
----------------------------------------------------------------------


On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz <h.schult...@yahoo.com> wrote:

> On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie <nos...@mckenzies.net>
> wrote:
>
>
>> There is no "compile" time.  PHP is interpreted so it is compiled and
>> then executed.
>>
>> If you always want error reporting, then set it in php.ini.
>>
>>
> It is compiled in no time, so there is no compile time?
> LOL


If you are a programmer you should know the difference between  Compiler and
Interpreter.   PHP is interpretted.
You are using term without knowing the meaning.

Just like javascript is run in browser  ... PHP is run at server while the
page is being served to the visitor  clear?

Now tell us your question again.

www.twitter.com/nine_L
www.lenin9l.wordpress.com

>
>
> --
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
9el wrote:
-----------------------------------------------------------------------
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
----------------------------------------------------------------------


On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz <h.schult...@yahoo.com> wrote:

On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie <nos...@mckenzies.net>
wrote:


There is no "compile" time.  PHP is interpreted so it is compiled and
then executed.

If you always want error reporting, then set it in php.ini.


It is compiled in no time, so there is no compile time?
LOL


If you are a programmer you should know the difference between  Compiler and
Interpreter.   PHP is interpretted.
You are using term without knowing the meaning.

Just like javascript is run in browser  ... PHP is run at server while the
page is being served to the visitor  clear?

Not necessarily - there are compilers for php, just like there are compilers for perl, though they are not needed. They can speed up the serving of pages and reduce resource consumption on the server.

It is also good practice to completely assemble the page before sending a single line (including headers) to the browser rather than send some data while still executing the script, in which case the script execution time could be likened to a compile time.
--- End Message ---
--- Begin Message --- Sorry, I didn't want to offend anyone :-) It was just very weird argument - to quote: "There is no "compile" time. PHP is interpreted so it is compiled and then executed."
Sounds like contradiction in this very sentence :-).

My apologies


On Fri, 27 Feb 2009 10:22:44 +0100, 9el <le...@phpxperts.net> wrote:

-----------------------------------------------------------------------
Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
a Free CD of Ubuntu mailed to your door without any cost. Visit :
www.ubuntu.com
----------------------------------------------------------------------


On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz <h.schult...@yahoo.com> wrote:

On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie <nos...@mckenzies.net>
wrote:


There is no "compile" time.  PHP is interpreted so it is compiled and
then executed.

If you always want error reporting, then set it in php.ini.


It is compiled in no time, so there is no compile time?
LOL


If you are a programmer you should know the difference between Compiler and
Interpreter.   PHP is interpretted.
You are using term without knowing the meaning.

Just like javascript is run in browser ... PHP is run at server while the
page is being served to the visitor  clear?

Now tell us your question again.

www.twitter.com/nine_L
www.lenin9l.wordpress.com



--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

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





--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/

--- End Message ---
--- Begin Message ---
On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote:
> Sorry, I didn't want to offend anyone :-) It was just very weird argument  
> - to quote:
> "There is no "compile" time.  PHP is interpreted so it is compiled and  
> then executed."
> Sounds like contradiction in this very sentence :-).
> 
> My apologies
> 
> 
> On Fri, 27 Feb 2009 10:22:44 +0100, 9el <le...@phpxperts.net> wrote:
> 
> > -----------------------------------------------------------------------
> > Use FreeOpenSourceSoftwares, Stop piracy, Let the developers live. Get
> > a Free CD of Ubuntu mailed to your door without any cost. Visit :
> > www.ubuntu.com
> > ----------------------------------------------------------------------
> >
> >
> > On Fri, Feb 27, 2009 at 3:08 PM, Hans Schultz <h.schult...@yahoo.com>  
> > wrote:
> >
> >> On Thu, 26 Feb 2009 22:38:13 +0100, Shawn McKenzie  
> >> <nos...@mckenzies.net>
> >> wrote:
> >>
> >>
> >>> There is no "compile" time.  PHP is interpreted so it is compiled and
> >>> then executed.
> >>>
> >>> If you always want error reporting, then set it in php.ini.
> >>>
> >>>
> >> It is compiled in no time, so there is no compile time?
> >> LOL
> >
> >
> > If you are a programmer you should know the difference between  Compiler  
> > and
> > Interpreter.   PHP is interpretted.
> > You are using term without knowing the meaning.
> >
> > Just like javascript is run in browser  ... PHP is run at server while  
> > the
> > page is being served to the visitor  clear?
> >
> > Now tell us your question again.
> >
> > www.twitter.com/nine_L
> > www.lenin9l.wordpress.com
> >
> >>
> >>
> >> --
> >> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> >>
> >> --
> >> PHP General Mailing List (http://www.php.net/)
> >> To unsubscribe, visit: http://www.php.net/unsub.php
> >>
> >>
> 
> 
> 
> -- 
> Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
> 
But if it never compiles, it can never run, but it can't run without
compiling? Arggh, my head. So does that mean if I go back in time and
shoot my grandfather, then nobody is in the woods to hear PHP try to
compile?


Ash
www.ashleysheridan.co.uk


--- End Message ---
--- Begin Message ---
Hahahah,I was thinking the same thing :D

--- On Fri, 2/27/09, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:
From: Ashley Sheridan <a...@ashleysheridan.co.uk>
Subject: Re: [PHP] "use strict" or similar in PHP?
To: "Hans Schultz" <h.schult...@yahoo.com>
Cc: php-gene...@lists.php.net, "9el" <le...@phpxperts.net>
Date: Friday, February 27, 2009, 1:11 PM

On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote:
> Sorry, I didn't want to offend anyone :-) It was just very weird
argument  
> - to quote:
> "There is no "compile" time.  PHP is interpreted so it is
compiled and  
> then executed."
> Sounds like contradiction in this very sentence :-).
> 
> My apologies
> 
But if it never compiles, it can never run, but it can't run without
compiling? Arggh, my head. So does that mean if I go back in time and
shoot my grandfather, then nobody is in the woods to hear PHP try to
compile?


Ash
www.ashleysheridan.co.uk




      

--- End Message ---
--- Begin Message ---
On Fri, 2009-02-27 at 13:11 +0000, Ashley Sheridan wrote:
> But if it never compiles, it can never run, but it can't run without
> compiling? Arggh, my head. So does that mean if I go back in time and
> shoot my grandfather, then nobody is in the woods to hear PHP try to
> compile?

There's a blurring of the lines these days with respect to compiled and
interpreted languages. At one time an interpreted language was truly
interpreted line-by-line as the code was running. But now, most
"interpreted" languages perform a compilation stage whereby the source
code is converted to bytecode or some internal representation of an
engine specific instruction tree. This internal representation is what
eAccelerator and APC caches use to speed up performance... specifically
they eliminate the compilation stage.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


--- End Message ---
--- Begin Message ---
From: Hans Schultz
> 
> Hahahah,I was thinking the same thing :D
> 
> --- On Fri, 2/27/09, Ashley Sheridan <a...@ashleysheridan.co.uk> wrote:
> From: Ashley Sheridan <a...@ashleysheridan.co.uk>
> Subject: Re: [PHP] "use strict" or similar in PHP?
> To: "Hans Schultz" <h.schult...@yahoo.com>
> Cc: php-gene...@lists.php.net, "9el" <le...@phpxperts.net>
> Date: Friday, February 27, 2009, 1:11 PM
> 
> On Fri, 2009-02-27 at 14:04 +0100, Hans Schultz wrote:
>> Sorry, I didn't want to offend anyone :-) It was just very weird
> argument  
>> - to quote:
>> "There is no "compile" time.  PHP is interpreted so it is
> compiled and  
>> then executed."
>> Sounds like contradiction in this very sentence :-).
>> 
>> My apologies
>> 
> But if it never compiles, it can never run, but it can't run without
> compiling? Arggh, my head. So does that mean if I go back in time and
> shoot my grandfather, then nobody is in the woods to hear PHP try to
> compile?

The compile process parses the text of the source file and translates it
into an alternate form. This can by byte code, ala Pascal and Java, or
executable code, ala COBOL and C. An interpreter, on the other hand,
simply parses the source file, line by line and executes each line as it
reads it, usually without saving it in an alternate form. This is the
way JavaScript works. Some languages, such as Perl, are somewhere
between the two. Perl parses the whole file, then executes only if it
did not find any syntax errors or undefined variables (if certain
strictures are turned on). Otherwise it prints out only the error
message.

>From what I have seen of PHP, it is strictly interpreted. i.e. a line is
read, and executed. Then the next line is read, and executed. etc. So
there is no way to get it to block execution from the beginning even
when there are fatal errors. It will already have printed out as much of
the page as it executed before it finds those errors. This works fine in
a development or test environment, but is a serious problem in
production.

So, I believe the question that was actually asked, is there any way to
induce PHP to completely parse the source file(s) and report any errors
before printing out anything, even the HTTP headers? Or can I set it to
redirect to an error page instead of sending an incomplete target page
with error messages that might reveal information I don't want exposed?

Bob McConnell

--- End Message ---
--- Begin Message ---
Good Day!

Probably, you have always thought you had to be an expert to make money on the 
Internet. Do you have any idea on how much money is being spent online these 
days?

We are here to give people the opportunity to make fast cash only by sitting in 
front of their home computers.

Learn how to start earning cash fast! Get your RISK-FREE trial kit! Google has 
earned people millions of dollars, it is time for you to get your share! See if 
you qualify for our RISK-FREE kit and start TODAY!
 
This is a very limited opportunity! It CANNOT exist for long to preserve the 
value for our members, so be fast in joining us - send us an email back to 
1926prochazka.caile...@gmail.com so we can sign you up immediately and you will 
get started! 

Please excuse us if you think that this email is sent to you by mistake or we 
have disturbed you in some way, but this is a serious and sincere offer, which 
made many people rich already.

With Respect,
Google Cash Team











------------------------------------------------------------------
This email has been written and proved to be in compliance with the recently 
established can-spam act law in US. We are not provoking or forcing any person 
in any way to participate in our programs. To participate is your own decision 
and you carry the responsibility of taking further part in this promotion. 
Anyway, if you don't want to receive more good offers from us, you can simply 
Unsubscribe by sending us a notification email to get.me_out_...@yahoo.com with 
a mail-subject and text "Unsubscribe me", and we will get your email out of our 
list within 10 days.

This message is STRICTLY CONFIDENTIAL and is solely for the individual or 
organisation to whom it is addressed. It may contain PRIVILEGED and 
CONFIDENTIAL information. If you are not the intended recipient, you are hereby 
notified that any dissemination, distribution or copying of this communication 
and its contents is strictly prohibited. If you are not interested in the 
offered promotions, please just don't answer. If you think you have received 
this message and its contents in error, please delete it from your computer, or 
follow the unsubscribing procedure shown above.
------------------------------------------------------------------
                

--- End Message ---
--- Begin Message ---
Hello *,

This list is subscribers only, and HOW can it be, that a Spamme can  use
a Debian mailinglist to spam <php-general>.  AFAIK it  is  not  possibel
for a mailinglist to subscribe itself to anoter mailinglist.

I  think,  the   listadmins   from   <list.php.net>   should   blacklist
<lists.debian.org>.

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>               <http://www.can4linux.org/>
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


--- End Message ---

Reply via email to