Re: [PHP] $this -

2004-12-02 Thread Klaus Reimer
R. Van Tassel wrote: Can someone please point me to the php documentation where it explains $this - 1. It must be $this- and not $this - . 2. Documentation can be found here: http://de.php.net/manual/en/language.oop.php What is the symbol - and is $this something only used in classes?

Re: [PHP] PHP 4 to 5 class issues involving static methods and $this

2004-11-17 Thread Klaus Reimer
Chris wrote: How can I rewrite my class for PHP 5 to emulate the functionality I had in PHP 4 in an error free way? Have you tried this: function format_string($string) { // format the string... $result = string; if (isset($this)) $this-elements[] = $result; return $result; } In

Re: [PHP] my own extension

2004-11-16 Thread Klaus Reimer
Uffe Kousgaard wrote: If I want to write my own extension for PHP/Linux, is there any specification on how to do that? Some specific functions that the SO should always include, call convention etc.? Those who know don't talk. Those who talk don't know. It's all in the docs (not much, but enough):

Re: [PHP] my own extension

2004-11-16 Thread Klaus Reimer
Uffe Kousgaard wrote: It is a large delphi library I want to call from PHP, so I don't think it is easier. But you know your library and you have it under control so maybe it's easier to write C include files to interface your Kylix library from C instead of writing Delphi-Units to interface PHP

Re: [PHP] splitting string

2004-11-16 Thread Klaus Reimer
Afan Pasalic wrote: But, I can't figure out how to split them back? $string_back = explode('\n', $string); That one is the right one. But you must use double quotes, not single quotes. Escaped characters (except \') in single quoted strings are not processed. -- PHP General Mailing List

[PHP] Overwriting offset methods of ArrayObject

2004-11-14 Thread Klaus Reimer
Hello, I just tried to overwrite a method of ArrayObject like this: class MyArrayObject extends ArrayObject { public function offsetGet($key) { echo Here I am\n; return parent::offsetGet($key); } } $o = new MyArrayObject(); $o['test'] = 'test';

Re: [PHP] Silly OOP question

2004-11-14 Thread Klaus Reimer
Brent Clements wrote: or should I create a projects.class file that has a function called getProjects. Yes, that's a possibility. You can even create more stuff in this Projects class like createProject, removeProject and stuff like this. If these tasks are pretty static and you don't need

Re: [PHP] Silly OOP question

2004-11-14 Thread Klaus Reimer
Daniel Schierbeck wrote: you can implement it completely statically so you don't need to instanciate the class Well, it might be useful to have more than one list of projects, ie if you want all design-related projects, or all PHP-projects. But then you might need a class to organize these

Re: [PHP] Converting a string into ASCII and a bit more - newbie

2004-11-14 Thread Klaus Reimer
Alp wrote: $x=1 while ($x=strlen($string)) { $holder = ord(substr($string, $x, 1)); $result = $result . $holder; } and failed since it takes ages to process and does not really return a proper value/result but repetitive number such as 1.. I think you forgot to increment

Re: [PHP] Session file not written, session variables messed up.

2004-11-12 Thread Klaus Reimer
Rodolfo wrote: The weirdness comes when in one frame the script will print Agent Smith while in the other frame of the same frameset the script which loads on it will print Thomas Anderson... Are both frames loaded at the same time? It's not possible to have two concurrently running scripts

Re: [PHP] zip_open + PHP 5

2004-11-11 Thread Klaus Reimer
Nick Halstead wrote: I have just changed to PHP 5 as I wanted to extend the functionality of one of my projects to further use its OO. But I just discovered that one of the extensions available under PHP 4+ isnt included in the same way, The zip_open + other functions are not available under the

Re: [PHP] Multiple session_start()s / Is it a problem??

2004-11-10 Thread Klaus Reimer
Al wrote: Is there a problem issuing multiple session_start()s for a given script? I can't find anything in the manual that says one way or the other. Then you have not looked good enough ;-) I have some scripts that call more than one functions include file and for convenience put a

Re: [PHP] PHP Accelerator

2004-11-09 Thread Klaus Reimer
Adrian Madrid wrote: I've been running Turck for some time now on PHP5 and haven't had segfault problems yet. I must say I'm running the latest CVS and using file sessions (Turck's would give you segfaults). I also tried latest CVS and I don't use Turcks cache. Maybe Turck has problems with

Re: [PHP] Arrays

2004-11-09 Thread Klaus Reimer
Zareef Ahmed wrote: But you need to do serialize and unserialize in case of array or object. Do :: $val_ar=array(one,two,three); $_SESSION['val_ar_store']=serialize($val_ar); Serialization is done automatically. You don't need to do it yourself. You can even store simple value-objects in the

Re: [PHP] PHP Accelerator

2004-11-09 Thread Klaus Reimer
raditha dissanayake wrote: I am also running turck with php5 without too many problems and that's why i recommended it to the OP. However none of the scripts that run on it make use of any of the new features of php5. One example: I'm using osCommerce, which is not using any new PHP5-features

Re: [PHP] Pb'lm of Regular Expression

2004-11-09 Thread Klaus Reimer
[EMAIL PROTECTED] wrote: thnx for your support every thing is working well but still one problem, that height and width are not coming so how i modify the first regular exp. so it shows both height and width. /img\s+.*?src=(.*?).*?/s

Re: [PHP] page redirect question

2004-11-09 Thread Klaus Reimer
Victor C. wrote: Is there anyway to redirect php page other than using HEADER(LOCATION:URL) ? Header can only be called if nothing is written to HTML... Is there anyway around it? You can use output buffering. Then it doesn't matter where you call header(). But if you do a redirect you should

Re: [PHP] MySQL

2004-11-09 Thread Klaus Reimer
Octavian Rasnita wrote: Please tell me how to send a null string to be inserted in a MySQL database. If I do something like: $string = null; mysql_query(insert ignore into table(field) values($string)); This will result in the following SQL query: insert ignore into table(field) values() If you

Re: [PHP] Pb'lm of Regular Expression

2004-11-08 Thread Klaus Reimer
[EMAIL PROTECTED] wrote: img src=\https://abc.com/first.php? site_id=abcaid=keyinlid=keyinref=q=\ width=\1\ height=\1\; /img\s+.*?src=(.*?).*?/s The complete tag is in index 0, the src is in index 1 of the match-array. Now what regular expression i write so i can fetch the image tag from my site

Re: [PHP] PHP Accelerator

2004-11-07 Thread Klaus Reimer
raditha dissanayake wrote: this one: - Turck MMCache for PHP Turck MM Cache does not work with PHP 5. It's possible to compile and load it and some pages are working but most of the time it segfaults. By the way: Does anybody know if the Turck MM Cache project is still active? The last change in

Re: [PHP] Downloading Large (100M+) Files

2004-11-04 Thread Klaus Reimer
Robin Getz wrote: The issue is that readfile writes it to the output buffer before sending it to the client. Are you sure you HAVE output buffering? What does ob_get_level() return? If it returns 0 then you don't have output buffering. My theory (and it's only a theory) is, that readfile may

[PHP] Shorthand functions (was: Code Snippets' you couldn't live without)

2004-11-04 Thread Klaus Reimer
Murray @ PlanetThoughtful wrote: with exploring include files to find out what a function does or how a class operates. I doubt half-a-dozen shorthand functions in that include file would place a measurable strain on the readability or maintainability of a project. I disagree on that. The problem

Re: [PHP] Sessions and threading

2004-11-04 Thread Klaus Reimer
Devraj Mukherjee wrote: The first part of the problem is that I need to be able to at all times maintain a readable set of objects in memory, I am planning to achieve that using session variables, but I hear that session variables can become very inefficient, how true is that? Very true. In

Re: [PHP] help in php script

2004-11-04 Thread Klaus Reimer
Deepak Dhake wrote: But i am not getting any output if i follow the above procedure. Can you tell me how to do it? I have to have the script TimeRotateImage.php which calculates which image to print accoring to local time and i want to embed the file name in html tag to print it on screen. It's

Re: [PHP] help in php script

2004-11-04 Thread Klaus Reimer
Deepak Dhake wrote: ?PHP print img src='TimeRotateImage.php'; ? did you get what i am saying? please let me know if you have some solution. thanks No. I must admit, It don't understand it. Let me try: You have a script a.php which outputs this static content: img src=b.php b.php outputs the

Re: [PHP] help in php script

2004-11-04 Thread Klaus Reimer
Klaus Reimer wrote: This can't work. You browser tries to download an image with the name 'img src=c.jpeg'. Ah, I'm talking nonsense. I meant the browser tries to DISPLAY an image with the CONTENT 'img src=c.jpeg'. The browser can't do this. That's why you don't see anything. -- Bye, K http

Re: [PHP] Downloading Large (100M+) Files

2004-11-04 Thread Klaus Reimer
Robin Getz wrote: The same problem exists with fpassthru (now that I have let it run a little longer) I now have 5 sleeping httpd processes on my system that are consuming 200Meg each. Any thoughts? Ok, so much for the theory. What about the output buffering? Have you checked if you have output

Re: [PHP] 'Code Snippets' you couldn't live without

2004-11-03 Thread Klaus Reimer
Murray @ PlanetThoughtful wrote: function asl($val){ function mfr($rset){ This may be ok for private projects but otherwise I don't think it's a good idea to create shorthand functions. Other developers (and especially new developers beginning to work on the project) are getting confused. They

Re: [PHP] 'Code Snippets' you couldn't live without

2004-11-03 Thread Klaus Reimer
Pablo Gosse wrote: extra with the results to suit your needs, but as for just using asl($val) instead of addslashes($val), well why not just extend the PHP source to make asl() an actual alias to addslashes()? Extending PHP to have shorthand functions? Was that irony? I hope so. Having such

Re: [PHP] 'Code Snippets' you couldn't live without

2004-11-03 Thread Klaus Reimer
Greg Donald wrote: Murray wasn't asking for your opinions on _his_ code, he was asking what code _you_ had that you couldn't live without, code that makes your life easier when reused from project to project. Ok then. Here comes mine (but not in form of source code. If someone is interested, mail

Re: [PHP] Help with preg_match_all()

2004-11-01 Thread Klaus Reimer
Curt Zirzow wrote: And so on.. It's a kind of a template system... well... I need to create a expression to get all the tags from the HTML with preg_match_all() in order to have them in a array... So your looking from something that starts with '{' and continues while not a ')' ... /{([^}]*?)}/

Re: [PHP] Need to add a 0 to a float number

2004-11-01 Thread Klaus Reimer
Brent Clements wrote: Solved my own problem Note to self, RTFM: number_format is w hat I needed. Or: printf(%.2f, $var); -- Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger [EMAIL PROTECTED] to get public key) signature.asc

Re: [PHP] An easier way? $_POST[] = $_SESSION[]

2004-11-01 Thread Klaus Reimer
Erich Kolb wrote: Is there an easier way to assign all post data from a form to session data? $_SESSION['first_name'] = $_POST['first_name']; $_SESSION['last_name'] = $_POST['last_name']; $_SESSION['email'] = $_POST['email']; If a two-dimensional array is ok for you then the easiest way is this:

Re: [PHP] Matching *exact* string?

2004-10-31 Thread Klaus Reimer
Nick Wilson wrote: How can I alter the above so that only *exact* matches are banned? Using ^ and $ to mark the begin and end of the line. So try this /^$ip\$/ -- Bye, K http://www.ailis.de/~k/ (FidoNet: 2:240/2188.18) [A735 47EC D87B 1F15 C1E9 53D3 AA03 6173 A723 E391] (Finger [EMAIL PROTECTED]

[PHP] localeconv

2004-10-30 Thread Klaus Reimer
Hi, I just noticed an annoying issue with locales in PHP and I'm not sure if this behaviour is intended or it's a bug. I'm doing the following: setlocale(LC_ALL, 'de_DE'); $l = localeconv(); printf(Decimal point: %s\n, $l['decimal_point']); printf(Thousands sep:

Re: [PHP] php compiler

2004-10-30 Thread Klaus Reimer
Hodicska Gergely wrote: $a = 0; $b = 1; if ($a = 1 $b = 0) { echo 'true '; var_dump($a); var_dump($b); } else { echo 'false '; var_dump($a); var_dump($b); } Runing this we get: true bool(false) int(0) Are you sure you posted the example correctly? It outputs this: false

Re: [PHP] php compiler

2004-10-30 Thread Klaus Reimer
Hodicska Gergely wrote: It outputs this: false bool(false) int(0) Yes, this the right output. And this output is absolutely correct. Your condition gives new values to $a and $b because you use = and not ==. So you do this: Maybe you never read this:

Re: [PHP] php compiler

2004-10-30 Thread Klaus Reimer
Hodicska Gergely wrote: $a = 1 $b = 0 PHP sees two expressions here: After the precedence table the first thing should be evaluating 1 $b, so we get: $a = false = 0 Which is not meaningful thing, and maybe this cause that the evaluating of the statment is not in the right order. = has a right

Re: [PHP] php compiler

2004-10-30 Thread Klaus Reimer
Hodicska Gergely wrote: Oke, but has a higher precedence. The right associativity has sense when all the operand has the same precedence. I think the precedence of left and right associative operands can't be compared. The switch between associativities already separates the expression (if it

[PHP] imagecopyresampled()

2004-06-29 Thread Klaus Reimer
Hello, I have a problem with imagecopyresampled() and I'm not sure if this is a bug in GD or PHP or it's a feature. I'm trying to do the following (This example doesn't make much sense, it's just a simple way to reproduce the problem): I have an alphatransparent image 512x512. I want to