On 23 April 2009 01:05, George Langley advised:
> Doh, of course! Just not thinking about the scope of
> the operator. If $var1 = 1, then !$var1 = 0
> Thanks everyone!
Well, actually, to be strictly accurate, since ! is a Boolean operator,
if $var1 = 1 then !$var1 = FALSE.
Cheers
I tend to put my return value in a variable and at the end of the
function I have 1 return statement.
I have seen others doing returns in the middle of the function.
Example how I do it:
function check($a) {
$return='';
if ( is_array( $a ) ) {
$return='Array';
} else {
$return='Not A
Peter van der Does wrote:
> I tend to put my return value in a variable and at the end of the
> function I have 1 return statement.
> I have seen others doing returns in the middle of the function.
>
> Example how I do it:
> function check($a) {
> $return='';
> if ( is_array( $a ) ) {
> $
From: Chris
Any light anyone can throw on the 'nob...@myserver.com' address
would be
most welcome.
>>>
>>> It is using the apache user @ your host name as the default. Try
this:
>>>
>>> ini_set('sendmail_from', 'whate...@wherever.com');
>>
>> I will try this but I do not understand why
On Thu, Apr 23, 2009 at 8:25 AM, Per Jessen wrote:
> Peter van der Does wrote:
>
>> I tend to put my return value in a variable and at the end of the
>> function I have 1 return statement.
>> I have seen others doing returns in the middle of the function.
>>
>> Example how I do it:
>> function che
At 5:33 PM -0400 4/22/09, PJ wrote:
Well, I'm making a page to do limited searching of the database. To keep
it simple I just want to search by title, author, ISBN or copyright
date. So, I need to input the user's choice, limit it to one of the
options and pass the supplied parameter to the quer
Hello list,
I'm developing a library and would need to know if the code calling my
library has already started a MySQL transaction or not. I want to know
whether I should start one or use savepoints instead -- starting a
transaction if one is already in progress commits the existing
transaction, a
On Thu, Apr 23, 2009 at 08:12:47AM -0400, Peter van der Does wrote:
> I tend to put my return value in a variable and at the end of the
> function I have 1 return statement.
> I have seen others doing returns in the middle of the function.
>
> Example how I do it:
> function check($a) {
> $retu
"tedd" wrote in message
news:p06240805c6161613a...@[192.168.1.101]...
> At 8:12 AM -0400 4/23/09, Peter van der Does wrote:
>>I tend to put my return value in a variable and at the end of the
>>function I have 1 return statement.
>>I have seen others doing returns in the middle of the function.
George Larson wrote:
> That's an interesting subject that I've never considered.
>
> I usually return immediately. For me, it makes the code easier to
> read. I work with a number of other coders here and, if the result
> isn't returned then I have to keep reading through the code to make
> sur
At 1:46 PM -0600 4/22/09, scubak1w1 wrote:
I am thinking that is where I am at... as you said, the user just needs to
know that there computer is busy, hang on a second already!
I like those icons - if I may be so bold though, and excuse the broadness of
the question, are you / can you use som
At 8:12 AM -0400 4/23/09, Peter van der Does wrote:
I tend to put my return value in a variable and at the end of the
function I have 1 return statement.
I have seen others doing returns in the middle of the function.
-snip-
What is your take? And is there any benefit to either method?
Peter v
Hi,
> while(true){
Yikes.
Personally, I'd put the return value wherever it will make the code
easier to read. If you're checking what has been passed as arguments,
and one of them is wrong, I think there's little point in continuing,
so an immediate return is the order of the day. Though with
ex
2009/4/23 Tony Marston :
>
> "tedd" wrote in message
> news:p06240805c6161613a...@[192.168.1.101]...
>> At 8:12 AM -0400 4/23/09, Peter van der Does wrote:
>>>I tend to put my return value in a variable and at the end of the
>>>function I have 1 return statement.
>>>I have seen others doing return
Richard Heyes wrote:
> Hi,
>
>> while(true){
>
> Yikes.
>
> Personally, I'd put the return value wherever it will make the code
> easier to read. If you're checking what has been passed as arguments,
> and one of them is wrong, I think there's little point in continuing,
> so an immediate retur
tedd wrote:
> At 5:33 PM -0400 4/22/09, PJ wrote:
>> Well, I'm making a page to do limited searching of the database. To keep
>> it simple I just want to search by title, author, ISBN or copyright
>> date. So, I need to input the user's choice, limit it to one of the
>> options and pass the suppli
At 2:19 PM +0100 4/23/09, Tony Marston wrote:
"tedd" wrote in message
> It's called "Structured programming" -- one way in and one way out of a
function.
There are, of course, exceptions where it might help others reviewing your
code to see what's going on, such as returning a null value i
At 10:11 AM -0400 4/23/09, PJ wrote:
tedd wrote:
> http://php1.net/a/edit-db-demo/
Here a user can search for a Last name, first name, or email. Note,
there's no checkboxes because the user indicates what they are
searching for by where they place their search criteria.
HTH's
tedd
Than
On Thu, 2009-04-23 at 10:14 -0400, tedd wrote:
> At 2:19 PM +0100 4/23/09, Tony Marston wrote:
> >"tedd" wrote in message
> > > It's called "Structured programming" -- one way in and one way out of a
> >> function.
> >>
> >> There are, of course, exceptions where it might help others reviewing
Hi there,
I am trying to unzip a zip file. Therefore I am using this function:
# unzip a file
function extract_zipfile($filename){
$zip = zip_open($filename);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
$fp = fopen(zip_entry_name($zip_entry), "w");
Merlin Morgenstern wrote:
> Hi there,
>
> I am trying to unzip a zip file. Therefore I am using this function:
>
> # unzip a file
> function extract_zipfile($filename){
> $zip = zip_open($filename);
> if ($zip) {
> while ($zip_entry = zip_read($zip)) {
> $fp = fopen(zip_entr
Shawn McKenzie wrote:
Merlin Morgenstern wrote:
Hi there,
I am trying to unzip a zip file. Therefore I am using this function:
# unzip a file
function extract_zipfile($filename){
$zip = zip_open($filename);
if ($zip) {
while ($zip_entry = zip_read($zip)) {
$fp = fopen(z
On Thu, Apr 23, 2009 at 10:14:28AM -0400, tedd wrote:
> At 2:19 PM +0100 4/23/09, Tony Marston wrote:
>> There is no such "rule", it is a matter of personal preference. As a
>> previous poster has already said, if you want to leave a function early
>> and
>> ignore all subsequent processing it
At 10:25 AM -0400 4/23/09, Robert Cummings wrote:
On Thu, 2009-04-23 at 10:14 -0400, tedd wrote:
> However, I am saying (after years of reading other people's code) it
is generally much easier to read code that follows "Structured
Programming" than it is to read code that doesn't.
Actually
Specifically, the __destruct() method of certain objects will be
called if an object goes out of scope due to an exception. Since
the __destruct() method didn't call the code that caused the
exception, it can't catch it.
I need the __destruct() method to behave differently if it's
called while a
tedd wrote:
> At 10:11 AM -0400 4/23/09, PJ wrote:
>> tedd wrote:
>> > http://php1.net/a/edit-db-demo/
>>>
>>> Here a user can search for a Last name, first name, or email. Note,
>>> there's no checkboxes because the user indicates what they are
>>> searching for by where they place their searc
Chris wrote:
> Luke wrote:
>> 2009/4/22 PJ
>>
>>> Could somebody explain to me the meaning of @ in $var =
>>> @$_POST['title'] ;
>>> where could I find a cheat sheet for those kinds of symbols or what are
>>> they called?
>>> Sorry for my ignorance, but maybe this will take the fog filter our of
>
Hello,
Besides the .htaccess which might be an apache configuration problem if
you use ini_set("mbstring.func_overload",2) in a script of this
directory does it work?
no, also the ini_set does not work for this Directive.
Sorry for the late reply.
The ini_set is meant to be used inside a p
Hi!
Please, tell me what's ReflectionMethod::invokeArgs first param for?
Since method always know it's class and it can only be invoked on it's own
class.
Regards,
K.L.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Merlin Morgenstern wrote:
>
>
> Shawn McKenzie wrote:
>> Merlin Morgenstern wrote:
>>> Hi there,
>>>
>>> I am trying to unzip a zip file. Therefore I am using this function:
>>>
>>> # unzip a file
>>> function extract_zipfile($filename){
>>> $zip = zip_open($filename);
>>> if ($zip) {
>>>
Is there a reason why you can't programatically set ownership of a
symbolic ink? The following code
if( symlink( TARGET, LINK ))
{
echo 'Successfully created ' . LINK . "\n";
if( @chown( LINK, NEW_UID ))
{
echo 'Successfully changed ownership for ' . LINK . "\n";
if( @chgrp( LINK,
>
>>
>> $fp = fopen(dirname($filename) . '/' . zip_entry_name($zip_entry), "w");
>>
>>
> thank you this worked. How come the . '/' . zip_entry_name($zip_entry) is
> needed? Looks like a double file name, but the result is ok. Could you
> explain this line?
read carefully, you'll understand too
On Thu, Apr 23, 2009 at 13:21, Christoph Boget
wrote:
> Is there a reason why you can't programatically set ownership of a
> symbolic ink? The following code
You can't do it from the command line either, Chris. This is
because chown and chgrp automatically dereference symlinks, so it's
actu
I have a function within a class. There is a variable inside that
function which I need to access & use outside of the class/function.
For example ...
Class Test {
function showOutput {
if ($this->url) {
$justTT = substr($this->url,-10,7);
I have a function within a class. There is a variable inside that
function which I need to access & use outside of the class/function.
For example ...
Class Test {
function showOutput {
if ($this->url) {
$justTT = substr($this->url,-10,7);
Is there a way to determine if a mysql query returns an empty set? I am
selecting 10 results at a time with a limit statement and need to know
when i've ran out of rows. I've only got 2 rows in the database, so
when I start with row 10, it returns an empty set. I have the following
code:
/
Yes!!! It works!! Thats' exactly what I was looking for ... getting
the value of $justTT in $othervar.
I'm new to classes ... thus the noobity!
On Apr 23, 2009, at 2:04 PM, Jônatas Zechim wrote:
Class Test {
function showOutput {
if ($this->url) {
mysql_num_rows() maybe? if not I probably haven't understood your question.
On Thu, Apr 23, 2009 at 8:12 PM, Adam Williams wrote:
> Is there a way to determine if a mysql query returns an empty set? I am
> selecting 10 results at a time with a limit statement and need to know when
> i've ran out
On Thu, Apr 23, 2009 at 2:12 PM, Adam Williams
wrote:
> Is there a way to determine if a mysql query returns an empty set? I am
> selecting 10 results at a time with a limit statement and need to know when
> i've ran out of rows. I've only got 2 rows in the database, so when I start
> with row 1
Nitsan Bin-Nun wrote:
mysql_num_rows() maybe? if not I probably haven't understood your question.
Thanks, I never thought of trying that. This code works!
$mysqli_get_requests = mysqli_query($mysqli,$get_requests);
if (!mysqli_num_rows($mysqli_get_requests))
Andrew Ballard wrote:
It won't be any of those because the query is successful even if it
returns no records. You could use
http://us2.php.net/manual/en/mysqli-stmt.num-rows.php to determine how
many rows were returned.
Andrew
Oh ok, thanks that makes sense. Thanks for the link also
--
Hello,
Sorry for the late reply.
no problem.
The ini_set is meant to be used inside a php script not in an .htaccess
file.
So perhaps you could test this in a script specific manner.
i know;) i do php/apache for some years...
i found out the problem in meanwhile.
http://bugs.php.net/bug.php?
PJ wrote:
> tedd wrote:
>
>> At 10:11 AM -0400 4/23/09, PJ wrote:
>>
>>> tedd wrote:
>>> > http://php1.net/a/edit-db-demo/
>>>
Here a user can search for a Last name, first name, or email. Note,
there's no checkboxes because the user indicates what they are
searchi
PJ wrote:
> tedd wrote:
>
>> At 10:11 AM -0400 4/23/09, PJ wrote:
>>
>>> tedd wrote:
>>> > http://php1.net/a/edit-db-demo/
>>>
Here a user can search for a Last name, first name, or email. Note,
there's no checkboxes because the user indicates what they are
searchi
At 4:58 PM -0400 4/23/09, PJ wrote:
>>> tedd wrote:
>>> > http://php1.net/a/edit-db-demo/
>>>
>H I've looked at your demo and, frankly, don't see it working.
When I enter names and click on one of the search buttons, I don't get
sane results. For instance, entering Johnson in last n
tedd wrote:
At 4:58 PM -0400 4/23/09, PJ wrote:
>>> tedd wrote:
>>> > http://php1.net/a/edit-db-demo/
>>>
>H I've looked at your demo and, frankly, don't see it working.
When I enter names and click on one of the search buttons, I don't get
sane results. For instance, entering John
the ini_set (or you can set the 5th param to the mail() function) is a
return-path. If the message bounces (recipient's mailbox full, server
down, whatever the reason) it gets delivered to that address. They
serve
different purposes.
The dirty little secret that nobody seems to know is th
Bogdan Stancescu wrote:
Hello list,
I'm developing a library and would need to know if the code calling my
library has already started a MySQL transaction or not. I want to know
whether I should start one or use savepoints instead -- starting a
transaction if one is already in progress commits t
On Tue, 21 Apr 2009 08:39:25 -0400, Bob McConnell wrote:
>I have been asked by a product manager what our options are for
>encrypting email messages with sensitive information. We are currently
>using PHPMailer to send email. What can be done to encrypt those
>messages? Can it be done without OOP?
Well, the latter method is generally easier to understand later. Most
programming style books preach this method, and it's the one that most of my
previous employers use.
Cheers...
-Original Message-
From: Peter van der Does [mailto:pvanderd...@gmail.com]
Sent: Thursday, April 23, 2009 8:
50 matches
Mail list logo