php-general Digest 8 Jan 2007 15:46:29 -0000 Issue 4558

Topics (messages 246732 through 246761):

Arrays?
        246732 by: William Stokes
        246734 by: Nicholas Yim
        246739 by: Sumeet
        246740 by: Sumeet

Re: Question regarding include() and symlinks to directories
        246733 by: Vincent DUPONT
        246735 by: Roman Neuhauser
        246746 by: Jochem Maas

Sending file stored on server via email - How?
        246736 by: Matt Arnilo S. Baluyos (Mailing Lists)
        246737 by: Roman Neuhauser
        246738 by: Ville Mattila

question about str_replace function
        246741 by: Kencana
        246742 by: M.Sokolewicz
        246743 by: Dick Jiang
        246750 by: Jochem Maas
        246753 by: Roman Neuhauser
        246754 by: Jochem Maas

Re: Windows directory listings
        246744 by: Jochem Maas

Re: ODBC and long text fields
        246745 by: Jochem Maas

computing 60/10 - how to?
        246747 by: Merlin
        246748 by: Jochem Maas
        246749 by: Edward Kay
        246751 by: Merlin
        246752 by: Merlin

send email by php class
        246755 by: afan.afan.net
        246756 by: Jochem Maas
        246757 by: afan.afan.net
        246758 by: Jochem Maas
        246760 by: afan.afan.net
        246761 by: Jochem Maas

unpack on offsets in binary data in variable?
        246759 by: Markus Fischer

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

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


----------------------------------------------------------------------
--- Begin Message ---
Hello,

How to print out the following array $test so that the print order is by the 
fourth[4] key? I need to print out all arrays in $test so that the data is 
ordered by the fourth key in ascending order.

$test =Array (
 [0] => Array (
  [0] => 5
  [1] => 2
  [2] => sika
  [3] => sika.php
  [4] => 1 )

 [1] => Array (
  [0] => 8
  [1] =>2
  [2] => Hono
  [3] => hono.php
  [4] => 1 )

 [2] => Array (
  [0] => 7
  [1] => 2
  [2] => Kameli
  [3] => kameli.php
  [4] => 4 )

 [3] => Array (
  [0] => 6
  [1] => 2
  [2] => koira
  [3] => koira.php
  [4] => 2 )
  )

The way that the data is strored to $test makes it difficult/impossible to 
sort stuff the way I need here while reading it from DB.

Thanks
-Will 

--- End Message ---
--- Begin Message ---
Hello William Stokes,

1 write a callback function:
  [php]
  function cmp_forth_value($left,$right){
    return $left[4]<$right?-1:($left[4]==$right[4]?0:1);
  }
  [/php]

2 use the usort function

  usort($test,'cmp_forth_value');

Best regards, 
  
======= At 2007-01-08, 14:46:33 you wrote: =======

>Hello,
>
>How to print out the following array $test so that the print order is by the 
>fourth[4] key? I need to print out all arrays in $test so that the data is 
>ordered by the fourth key in ascending order.
>
>$test =Array (
> [0] => Array (
>  [0] => 5
>  [1] => 2
>  [2] => sika
>  [3] => sika.php
>  [4] => 1 )
>
> [1] => Array (
>  [0] => 8
>  [1] =>2
>  [2] => Hono
>  [3] => hono.php
>  [4] => 1 )
>
> [2] => Array (
>  [0] => 7
>  [1] => 2
>  [2] => Kameli
>  [3] => kameli.php
>  [4] => 4 )
>
> [3] => Array (
>  [0] => 6
>  [1] => 2
>  [2] => koira
>  [3] => koira.php
>  [4] => 2 )
>  )
>
>The way that the data is strored to $test makes it difficult/impossible to 
>sort stuff the way I need here while reading it from DB.
>
>Thanks
>-Will 
>
>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>
>

= = = = = = = = = = = = = = = = = = = =
                        
Nicholas Yim
[EMAIL PROTECTED]
2007-01-08

--- End Message ---
--- Begin Message ---
Nicholas Yim wrote:
> Hello William Stokes,
> 
> 1 write a callback function:
>   [php]
>   function cmp_forth_value($left,$right){
>     return $left[4]<$right?-1:($left[4]==$right[4]?0:1);

return $left[4]<$right[4]?-1:($left[4]==$right[4]?0:1);
                      ^^^
                   add this
>   }
>   [/php]
> 
> 2 use the usort function
> 
>   usort($test,'cmp_forth_value');
> 
> Best regards, 


-- 
Thanking You

Sumeet Shroff
http://www.prateeksha.com
Web Designers and PHP / Mysql Ecommerce Development, Mumbai India

--- End Message ---
--- Begin Message ---
Nicholas Yim wrote:
> Hello William Stokes,
> 
> 1 write a callback function:
>   [php]
>   function cmp_forth_value($left,$right){
>     return $left[4]<$right?-1:($left[4]==$right[4]?0:1);

return $left[4]<$right[4]?-1:($left[4]==$right[4]?0:1);
                      ^^^
                   add this
>   }
>   [/php]
> 
> 2 use the usort function
> 
>   usort($test,'cmp_forth_value');
> 
> Best regards, 


-- 
Thanking You

Sumeet Shroff
http://www.prateeksha.com
Web Designers and PHP / Mysql Ecommerce Development, Mumbai India

--- End Message ---
--- Begin Message ---
hello,
if I can still contribute to this topic, I suggest you never use simlinks.
We experienced very bad maintenance problems at a customer : when copying new 
files through FTP, the simlinks were often erased or overwriten. 
And this occured on every upgrade of the scripts.

This would not occur with a simple and stable include_path setting. Moreover, 
one can set the include_path dircetly from PHP, allowing for example 2 
applications to define their own include_path.

Finaly, simlinks are not available on win32 platforms.

So, the include_path should be more stable (considering FTP) and more flexible 
than simlinks.



Vincent Dupont
Ausy Belgium



-----Original Message-----
From: Richard Lynch [mailto:[EMAIL PROTECTED]
Sent: Sat 1/6/2007 0:17
To: Karl Pflästerer
Cc: php-general@lists.php.net
Subject: Re: [PHP]  Question regarding include() and symlinks to directories
 
On Thu, January 4, 2007 2:47 pm, Karl Pflästerer wrote:
> In my opinion include() should respect symlinks to directories and not
> dereference them before finding the file to include. Or am I wrong
> here?
> The PHP version is 5.1.6 (will soon be updated).

WHOOPS!

My fingers slipped and I keyboarded to "Send" button.

SORRY!

... and use full pathname when you go to read a file.

Anything else is more like playing an Adventure Game than Programming.

I can see arguments both ways for when to work out the symlink, so
you'd have to take this up with Internals to get a change made...

-- 
Some people have a "gift" link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

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

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-08 08:13:11 +0100:
> From: Richard Lynch [mailto:[EMAIL PROTECTED]
> > Sent: Sat 1/6/2007 0:17
> > To: Karl Pflästerer
> > Cc: php-general@lists.php.net
> > Subject: Re: [PHP]  Question regarding include() and symlinks to directories
> >  
> > On Thu, January 4, 2007 2:47 pm, Karl Pflästerer wrote:
> > > In my opinion include() should respect symlinks to directories and not
> > > dereference them before finding the file to include. Or am I wrong
> > > here?
> > > The PHP version is 5.1.6 (will soon be updated).
> > 
> > Anything else is more like playing an Adventure Game than Programming.
> > 
> > I can see arguments both ways for when to work out the symlink, so
> > you'd have to take this up with Internals to get a change made...
> 
> if I can still contribute to this topic, I suggest you never use simlinks.
> We experienced very bad maintenance problems at a customer : when
> copying new files through FTP, the simlinks were often erased or
> overwriten.  And this occured on every upgrade of the scripts.

Shouldn't that have been: "never use broken FTP clients"?

NB, I hope I got the quoting right, but if someone got misattributed,
please blame the original quoting.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
Vincent DUPONT wrote:
> hello,
> if I can still contribute to this topic, I suggest you never use simlinks.
> We experienced very bad maintenance problems at a customer : when copying new 
> files through FTP, the simlinks were often erased or overwriten. 
> And this occured on every upgrade of the scripts.
> 
> This would not occur with a simple and stable include_path setting. Moreover, 
> one can set the include_path dircetly from PHP, allowing for example 2 
> applications to define their own include_path.
> 
> Finaly, simlinks are not available on win32 platforms.

not completely true - windows does have something they like to call hardlinks - 
which pretty
much do the same thing:

http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/fsutil_hardlink.mspx?mfr=true

that said I also would recommend using a well thought out include_path strategy 
over a solution that
uses symlinks, given the choice. of course Karl is living a deployed, 
production system
and he probably does not have the luxury of *just* switching over.
> 
> So, the include_path should be more stable (considering FTP) and more 
> flexible than simlinks.
> 
> 
> 
> Vincent Dupont
> Ausy Belgium
> 
> 
> 
> -----Original Message-----
> From: Richard Lynch [mailto:[EMAIL PROTECTED]
> Sent: Sat 1/6/2007 0:17
> To: Karl Pflästerer
> Cc: php-general@lists.php.net
> Subject: Re: [PHP]  Question regarding include() and symlinks to directories
>  
> On Thu, January 4, 2007 2:47 pm, Karl Pflästerer wrote:
>> In my opinion include() should respect symlinks to directories and not
>> dereference them before finding the file to include. Or am I wrong
>> here?
>> The PHP version is 5.1.6 (will soon be updated).
> 
> WHOOPS!
> 
> My fingers slipped and I keyboarded to "Send" button.
> 
> SORRY!
> 
> ... and use full pathname when you go to read a file.
> 
> Anything else is more like playing an Adventure Game than Programming.
> 
> I can see arguments both ways for when to work out the symlink, so
> you'd have to take this up with Internals to get a change made...
> 

--- End Message ---
--- Begin Message ---
Hello everyone,

I store files on the server (.pdf, .doc, .txt, etc.) which are
referenced by entries in a database. The filenames are only stored in
the database and are not BLOBs.

What I'd like to do is to be able to show a web form wherein a user
can choose stored documents on the server and send it to an email.

What's the easiest way to go about this? Specifically, what's the
easiest way to read a file from the server and send it as an email
attachment.

Best Regards,
Matt

--
Stand before it and there is no beginning.
Follow it and there is no end.
Stay with the ancient Tao,
Move with the present.

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-08 19:06:16 +1100:
> Hello everyone,
> 
> I store files on the server (.pdf, .doc, .txt, etc.) which are
> referenced by entries in a database. The filenames are only stored in
> the database and are not BLOBs.
> 
> What I'd like to do is to be able to show a web form wherein a user
> can choose stored documents on the server and send it to an email.
> 
> What's the easiest way to go about this? Specifically, what's the
> easiest way to read a file from the server and send it as an email
> attachment.

uuencode yourfile | mail -s "my subject" [EMAIL PROTECTED]

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
Matt Arnilo S. Baluyos (Mailing Lists) kirjoitti:
What's the easiest way to go about this? Specifically, what's the
easiest way to read a file from the server and send it as an email
attachment.

I would suggest you to use http://phpmailer.sourceforge.net/ that is a featured class for sending e-mails from PHP scripts. It supports file attachments too. Messages can be sent over sendmail or direct SMTP with the PHPMailer.

(Untested) example:

require_once "class.phpmailer.php";
$mailer = new PHPMailer();
$mailer->AddAttachment("/tmp/myattachment.pdf","Attachment.pdf","base64","application/pdf");
$mailer->AddAddress("[EMAIL PROTECTED]");
$mailer->Subject = "PDF Attachment";
$mailer->Body = "This is a message with PDF attachment.";
$mailer->Send();


Ville

--- End Message ---
--- Begin Message ---
Hi all,

I got a doubt about the str_replace function.

<?php 
$string="avenue 1, ave 1";
$words=str_replace ("ave","avenue", $string);
echo $words;
?>

the php code above will return me "avenuenue 1, avenue 1". i expect the
result will be "avenue 1, avenue 1". any idea of how can i get such result?

Thank you

Regards,
Kencana

-- 
View this message in context: 
http://www.nabble.com/question-about-str_replace-function-tf2938171.html#a8214599
Sent from the PHP - General mailing list archive at Nabble.com.

--- End Message ---
--- Begin Message ---
change it to
<?php
$string="avenue 1, ave 1";
$words=str_replace ("ave ","avenue ", $string);
echo $words;
?>

Kencana wrote:
Hi all,

I got a doubt about the str_replace function.

<?php $string="avenue 1, ave 1";
$words=str_replace ("ave","avenue", $string);
echo $words;
?>

the php code above will return me "avenuenue 1, avenue 1". i expect the
result will be "avenue 1, avenue 1". any idea of how can i get such result?

Thank you

Regards,
Kencana


--- End Message ---
--- Begin Message ---
 I think you'd better use regular expression to replace the word

Regards,
Dick
-----Original Message-----
From: Kencana [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 08, 2007 5:12 PM
To: php-general@lists.php.net
Subject: [PHP] question about str_replace function


Hi all,

I got a doubt about the str_replace function.

<?php 
$string="avenue 1, ave 1";
$words=str_replace ("ave","avenue", $string);
echo $words;
?>

the php code above will return me "avenuenue 1, avenue 1". i expect the
result will be "avenue 1, avenue 1". any idea of how can i get such result?

Thank you

Regards,
Kencana

-- 
View this message in context:
http://www.nabble.com/question-about-str_replace-function-tf2938171.html#a82
14599
Sent from the PHP - General mailing list archive at Nabble.com.

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

--- End Message ---
--- Begin Message ---
Dick Jiang wrote:
>  I think you'd better use regular expression to replace the word

agreed - only it a serious dive in the deep end of regexps - the OP may
have to use a negative lookahead assertion, something like:

$string="avenue 1, ave 1 both have av+e :-)";
$words = preg_replace("#\\bave(?!nue)#", "avenue", $string);



> 
> Regards,
> Dick
> -----Original Message-----
> From: Kencana [mailto:[EMAIL PROTECTED] 
> Sent: Monday, January 08, 2007 5:12 PM
> To: php-general@lists.php.net
> Subject: [PHP] question about str_replace function
> 
> 
> Hi all,
> 
> I got a doubt about the str_replace function.
> 
> <?php 
> $string="avenue 1, ave 1";
> $words=str_replace ("ave","avenue", $string);
> echo $words;
> ?>
> 
> the php code above will return me "avenuenue 1, avenue 1". i expect the
> result will be "avenue 1, avenue 1". any idea of how can i get such result?
> 
> Thank you
> 
> Regards,
> Kencana
> 

--- End Message ---
--- Begin Message ---
# [EMAIL PROTECTED] / 2007-01-08 11:35:06 +0100:
> Dick Jiang wrote:
> >  I think you'd better use regular expression to replace the word
> 
> agreed - only it a serious dive in the deep end of regexps - the OP may
> have to use a negative lookahead assertion, something like:
> 
> $string="avenue 1, ave 1 both have av+e :-)";
> $words = preg_replace("#\\bave(?!nue)#", "avenue", $string);

That'll also make "average" into "avenuerage". A word-boundary assertion
should (admittedly, I didn't check) be fine on both sides: '#\bave\b#'.

-- 
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man.  You don't KNOW.
Cause you weren't THERE.             http://bash.org/?255991

--- End Message ---
--- Begin Message ---
Roman Neuhauser wrote:
> # [EMAIL PROTECTED] / 2007-01-08 11:35:06 +0100:
>> Dick Jiang wrote:
>>>  I think you'd better use regular expression to replace the word
>> agreed - only it a serious dive in the deep end of regexps - the OP may
>> have to use a negative lookahead assertion, something like:
>>
>> $string="avenue 1, ave 1 both have av+e :-)";
>> $words = preg_replace("#\\bave(?!nue)#", "avenue", $string);
> 
> That'll also make "average" into "avenuerage". A word-boundary assertion
> should (admittedly, I didn't check) be fine on both sides: '#\bave\b#'.

I think you are correct.

> 

--- End Message ---
--- Begin Message ---
Beauford wrote:
>  


...

>>>
>>>
>>> function searchdir ( $page , $maxdepth = -1 , $mode = 
>> "FILES" , $d = 0 ) {
>>>    if ( substr ( $page , strlen ( $page ) - 1 ) != '\\' ) { 
>> $page .= 
>>> '\\' ;}
>> this if statement will run given the value of $page, it's not 
>> needed AFAIKT.
>> then again I can't see it causing problems.
> 
> This makes no difference. I took it out before and got the same error.
> 

I didn't think it would.

...

> So if I put $page = "test", or $page = "test3", or $page = "../" they will
> all work. As soon as I add a drive letter, it gives me the error. Even on
> the local machine.
> 
> I am trying to access a networked drive, but I have a share on the PC where
> the script is. May this is the issue. 

the mapped drive should not be a problem. I definitely think it's a permission 
issue,
of course I could be wrong.

the following bug report *might* give you a clue as to whats going on:

        http://bugs.php.net/bug.php?id=22153&edit=1

I have a feeling the bit about setting the permissions of the Share
to Everyone (on the server) is a good place to start. (the point about
having to login to the share manually before php is able to connect is also
noteworthy)

also bare in mind that a Drive/Directory has a set of permissions that are
seperate to the permissions of a Share that is defined for said Drive/Directory,
(something that has always confused me a bit) - both need to be setup to 
appropriately

> Is there a way to use a UNC path?

things I came across suggests this can work - something like?:

        $dir = opendir(""\\\\your.ip.add.ress\\your_share"");

>  

...

> 

--- End Message ---
--- Begin Message ---
Larry Garfield wrote:
> On Sunday 07 January 2007 8:26 pm, Jochem Maas wrote:
> 

...

>>
>> with regard to wanting results returned in a 'named' fashion, does the new
>> setup still not allow use of odbc_fetch_array() instead of
>> odbc_fetch_row()? not that I see any logic in that solving the issue, again
>> it might be worth trying to see if it does.
> 
> Honestly I've not tried.  (I also don't have the wrapper code in front of me 
> at the moment. <g>)  That could be a nice thing to simplify for performance, 
> but I suspect that if the problem is with odbc_fetch_row() then 
> odbc_fetch_array() will have the same bug.

quite likely - but you never know until you give it a shot - weirder things 
have happened :-)

> 
>> I don't know much about MSSQL, or whether 'text' is an actual field type,
>> but maybe this function offers a wayout?:
>>
>>      http://php.net/manual/en/function.odbc-binmode.php
> 
> No, that looks like it's for binary data.  "Text" is a MS SQL field for 
> huge-ass text fields, essentially similar to the MySQL field of the same name 
> (at least at an API level).  We also tried playing with odbc_longreadlen() 
> and setting MS SQL's TEXTSIZE and TEXTLENGTH parameters to no avail.

ah I see; double drat!

> 
>> are the php versions on the 2 systems you mention exactly the same? (you
>> mention 5.1 and 5.1.6) this could be a clue to the problem.
> 
> It's either both 5.1.6 or 5.1.6 live and 5.1.4 devel.  (I don't recall what 
> our exact version is atm.)  We're in the process of upgrading our server 
> soon, and I'm not sure what it will have.  Probably 5.2, just to keep life 
> interesting. :-)

I would get the systems running exactly the same version just to rule out that
as a possible source of the problem.

> 
>> lastly I don't suppose that it possible for you to switch to using the
>> MSSQL specific php extension? [http://php.net/mssql] it might offer a
>> better/faster connection to the MSSQL server as well as making the issue go
>> away.
> 
> I don't believe the client allows direct MSSQL connections.  Besides, the 
> MSSQL functions still require an ODBC driver underneath, 

I didn't know that.

> so if the problem is 
> with the ODBC driver then that won't change anything.

if what you say is true then it it would be a great way of determining if the
it is the ODBC driver that's the problem, and if using MSSQL extension make the 
problem
dissapear then you have a solution (given that it has to use an ODBC driver 
underneath,
you will still be conforming to the client's requirements by not connecting
directly).

sorry I couldn't be of more help/

> 

--- End Message ---
--- Begin Message ---
Hi there,

I do have a text value inside a variable: exif[FNumber] = 56/10 which I would like to save as a float value: 5,6 into a database.

How can I compute this 56/10? I tried things like calculate() or math() but did not find the propper function to do this.

Can anybody help, please?

Thank you in advance,

Merlin

--- End Message ---
--- Begin Message ---
Merlin wrote:
> Hi there,
> 
> I do have a text value inside a variable: exif[FNumber] = 56/10 which I
> would like to save as a float value: 5,6 into a database.
> 
> How can I compute this 56/10? I tried things like calculate() or math()
> but did not find the propper function to do this.
> 
> Can anybody help, please?

if you know the string is always in the form: "number / number"
you might do something like:

<?php

$str  = "56/10";
$bits = explode("/", $str);
$num1 = floatval($bits[0]) / floatval($bits[1]);
echo $num1;

?>

another way to go *might* be to use eval() - note that eval() is
almost *always* the wrong solution to a problem:

<?php

$str = "56/10";
eval("\$num1 = {$str};");
echo $num1;

?>

> 
> Thank you in advance,
> 
> Merlin
> 

--- End Message ---
--- Begin Message ---
You could use exec() but that's not good practice due to the security
implications.

I'd extract the two numbers using explode() on the / and then just use the
division operator.

Edward

> -----Original Message-----
> From: Merlin [mailto:[EMAIL PROTECTED]
> Sent: 08 January 2007 10:22
> To: php-general@lists.php.net
> Subject: [PHP] computing 60/10 - how to?
>
>
> Hi there,
>
> I do have a text value inside a variable: exif[FNumber] = 56/10 which I
> would like to save as a float value: 5,6 into a database.
>
> How can I compute this 56/10? I tried things like calculate() or math()
> but did not find the propper function to do this.
>
> Can anybody help, please?
>
> Thank you in advance,
>
> Merlin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>

--- End Message ---
--- Begin Message ---
Jochem Maas schrieb:
Merlin wrote:
Hi there,

I do have a text value inside a variable: exif[FNumber] = 56/10 which I
would like to save as a float value: 5,6 into a database.

How can I compute this 56/10? I tried things like calculate() or math()
but did not find the propper function to do this.

Can anybody help, please?

if you know the string is always in the form: "number / number"
you might do something like:

<?php

$str  = "56/10";
$bits = explode("/", $str);
$num1 = floatval($bits[0]) / floatval($bits[1]);
echo $num1;

?>

another way to go *might* be to use eval() - note that eval() is
almost *always* the wrong solution to a problem:

<?php

$str = "56/10";
eval("\$num1 = {$str};");
echo $num1;

?>

Thank you in advance,

Merlin


Hi,

thank you that works. But unfortunatelly the notation out of this calculation is with a comma instead of a point. is there a way to have the output with a . instead of a ,
Example: 5.6 instead of 5,6

thank you for your help,

Merlin

--- End Message ---
--- Begin Message ---
Merlin schrieb:
Jochem Maas schrieb:
Merlin wrote:
Hi there,

I do have a text value inside a variable: exif[FNumber] = 56/10 which I
would like to save as a float value: 5,6 into a database.

How can I compute this 56/10? I tried things like calculate() or math()
but did not find the propper function to do this.

Can anybody help, please?

if you know the string is always in the form: "number / number"
you might do something like:

<?php

$str  = "56/10";
$bits = explode("/", $str);
$num1 = floatval($bits[0]) / floatval($bits[1]);
echo $num1;

?>

another way to go *might* be to use eval() - note that eval() is
almost *always* the wrong solution to a problem:

<?php

$str = "56/10";
eval("\$num1 = {$str};");
echo $num1;

?>

Thank you in advance,

Merlin


Hi,

thank you that works. But unfortunatelly the notation out of this calculation is with a comma instead of a point. is there a way to have the output with a . instead of a ,
Example: 5.6 instead of 5,6

thank you for your help,

Merlin

sorry my fault. It does output a point.

--- End Message ---
--- Begin Message ---
Hi,
To send email confirmation (after registration or to administrator after
Contact us form is submitted) I use the "standard" way:

function send_confirmation($to, $subject, $message)
{
    $header  = "Content-type: text/plain; charset=iso-8859-1\n";
    $header .= "From: Vernon Company <[EMAIL PROTECTED]>\n";
    $header .= "Reply-To: Order Processing Dept.
<[EMAIL PROTECTED]>\n";
    mail($to, $subject, $message, $header);
}

send_confirmation($SalesEmail, $Subject, $Message);

It works fine, though, few times email was blocked and finished in
Junk/Bulk/Spam folder.

Now, I have to start sending emails as html. Not big deal.
But, it's so easy to get blacklisted if you make a mistake and I wanted to
grab and use good email class to do this. OUr web server is php5 based.

Was looking on phpclasses.net for the class but there are tons of them.
Can somebody recomend any class? Something simple.

Thanks for any help.

-afan

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
> Hi,
> To send email confirmation (after registration or to administrator after
> Contact us form is submitted) I use the "standard" way:
> 
> function send_confirmation($to, $subject, $message)
> {
>     $header  = "Content-type: text/plain; charset=iso-8859-1\n";
>     $header .= "From: Vernon Company <[EMAIL PROTECTED]>\n";
>     $header .= "Reply-To: Order Processing Dept.
> <[EMAIL PROTECTED]>\n";
>     mail($to, $subject, $message, $header);
> }
> 
> send_confirmation($SalesEmail, $Subject, $Message);
> 
> It works fine, though, few times email was blocked and finished in
> Junk/Bulk/Spam folder.
> 
> Now, I have to start sending emails as html. Not big deal.
> But, it's so easy to get blacklisted if you make a mistake and I wanted to
> grab and use good email class to do this. OUr web server is php5 based.
> 
> Was looking on phpclasses.net for the class but there are tons of them.
> Can somebody recomend any class? Something simple.

phpmailer.sourceforge.net

> 
> Thanks for any help.
> 
> -afan
> 

--- End Message ---
--- Begin Message ---
> [EMAIL PROTECTED] wrote:
>> Hi,
>> To send email confirmation (after registration or to administrator after
>> Contact us form is submitted) I use the "standard" way:
>>
>> function send_confirmation($to, $subject, $message)
>> {
>>     $header  = "Content-type: text/plain; charset=iso-8859-1\n";
>>     $header .= "From: Vernon Company <[EMAIL PROTECTED]>\n";
>>     $header .= "Reply-To: Order Processing Dept.
>> <[EMAIL PROTECTED]>\n";
>>     mail($to, $subject, $message, $header);
>> }
>>
>> send_confirmation($SalesEmail, $Subject, $Message);
>>
>> It works fine, though, few times email was blocked and finished in
>> Junk/Bulk/Spam folder.
>>
>> Now, I have to start sending emails as html. Not big deal.
>> But, it's so easy to get blacklisted if you make a mistake and I wanted
>> to
>> grab and use good email class to do this. OUr web server is php5 based.
>>
>> Was looking on phpclasses.net for the class but there are tons of them.
>> Can somebody recomend any class? Something simple.
>
> phpmailer.sourceforge.net
I think this is it.
:)

Thanks Jochem.


>
>>
>> Thanks for any help.
>>
>> -afan
>>
>
>

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
>> [EMAIL PROTECTED] wrote:
>>> Hi,

...

>>>
>>> Was looking on phpclasses.net for the class but there are tons of them.
>>> Can somebody recomend any class? Something simple.
>> phpmailer.sourceforge.net
> I think this is it.
> :)

not to sound like an ass (there's at least 3 people out there that will hear me 
going 'Eeee Aw'
regardless of what I say so what the hack) - but this has been mentioned about 
3 times on
the list on the last week, it's one of these ones things that keeps coming up.

this is a good example of why scanning the list on a regular basis (and/or 
doing the
occasional search in the archives when your looking into a problem) is a really
good idea.

I can't emphasize enough how much I personally learn from just reading questions
and answers on this list - many a time I've [vaguely] remembered reading 
something
that I didn't quite understand at the time but 6 months later I was confronted
by a similar problem and I was able to solve the problem in a fraction of the 
time
that it would have taken if I had not read whatever thread was relevant.

an extension to this is trying to answer questions that you don't actually know 
the
answers to ... the act of trying to figure out someone else's questions/problems
can often be a great way to increase your skills ... additionally it's good 
practice
for solving the problems you encounter in your own work, I remember when I first
started out that trying things out, researching and debugging problems was 
often a
very daunting proposition [that never-ending-story feeling] ... I have found 
that
the more practice the less impedance I find when it comes to figuring out 
something
I'm stuck on ... this is pretty obvious I guess, but worth mentioning.

--- End Message ---
--- Begin Message ---
> [EMAIL PROTECTED] wrote:
>>> [EMAIL PROTECTED] wrote:
>>>> Hi,
>
> ...
>
>>>>
>>>> Was looking on phpclasses.net for the class but there are tons of
>>>> them.
>>>> Can somebody recomend any class? Something simple.
>>> phpmailer.sourceforge.net
>> I think this is it.
>> :)
>
> not to sound like an ass (there's at least 3 people out there that will
> hear me going 'Eeee Aw'
> regardless of what I say so what the hack) - but this has been mentioned
> about 3 times on
> the list on the last week, it's one of these ones things that keeps coming
> up.
>
> this is a good example of why scanning the list on a regular basis (and/or
> doing the
> occasional search in the archives when your looking into a problem) is a
> really
> good idea.
>
> I can't emphasize enough how much I personally learn from just reading
> questions
> and answers on this list - many a time I've [vaguely] remembered reading
> something
> that I didn't quite understand at the time but 6 months later I was
> confronted
> by a similar problem and I was able to solve the problem in a fraction of
> the time
> that it would have taken if I had not read whatever thread was relevant.
>
> an extension to this is trying to answer questions that you don't actually
> know the
> answers to ... the act of trying to figure out someone else's
> questions/problems
> can often be a great way to increase your skills ... additionally it's
> good practice
> for solving the problems you encounter in your own work, I remember when I
> first
> started out that trying things out, researching and debugging problems was
> often a
> very daunting proposition [that never-ending-story feeling] ... I have
> found that
> the more practice the less impedance I find when it comes to figuring out
> something
> I'm stuck on ... this is pretty obvious I guess, but worth mentioning.
>
>

Jochem,
I'm reading most of the posted questions/answers on the mailing list
because of exact reason you mentioned. You're right. But, don't remember
any that can help me with this issue. Though, wasn't detailed and give a
chance to missed these. :)
In general, yes, you're right, I could/should spend a bit more time
scanning Archive and most likely find the answer there. Accept your
critisizm and applogy.

-afan

--- End Message ---
--- Begin Message ---
[EMAIL PROTECTED] wrote:
>> [EMAIL PROTECTED] wrote:
>>>> [EMAIL PROTECTED] wrote:
>>>>> Hi,
>> ...
>>

...

> 
> Jochem,
> I'm reading most of the posted questions/answers on the mailing list
> because of exact reason you mentioned. You're right. But, don't remember
> any that can help me with this issue. Though, wasn't detailed and give a
> chance to missed these. :)

murphy's law number XYZ: whatever your looking for is always in the
last place you look :-)

> In general, yes, you're right, I could/should spend a bit more time
> scanning Archive and most likely find the answer there. 

I'll freely admit to writing that 'advice' to also remind myself
to eat my own dogfood. ;-)

> Accept your
> critisizm and applogy.

it was not meant as critism - definitely no apology please!

I was just a bit surprised that you didn't catch the earlier
references to phpmailer.

--- End Message ---
--- Begin Message ---
Hi,

I'm searching for an efficient way to use unpack on binary data within a
variable (php 5.1.something). In the past I was doing

fopen
fseek
unpack( fread(...)
fseek
etc.

Now this time I need to do the same, but I don't have an actual file: my
data is only in a variable and I don't want to operate on a file but the
variable within.

I was thinking about using substr() and passing the small chunks of data
I need to the unpack() function.

Question: does this work without problems on arbitrary binary, maybe
containing zero-byte values reliable?

thanks,
- Markus

--- End Message ---

Reply via email to