php5

Is there any good php5 OOP tutorial site?

Is there any good php5 OOP tutorial site? I Googled for a while ,and found that there are all of PHP4 OOP site everywhere. ...

php's command line option parsing, howto

I'm using Console_Getopt in PHP 5.2, and finding it surprising about how different it is from getopt in other languages (perl, bash, java). Can anyone recommend how to parse the args from the array "$opts" returned? php myprog.php -a varA -c -b varB $o= new Console_Getopt; $opts = $o->getopt($argv, "a:b:c"); print_r($opts); // the p...

zip_open(); undefined on PHP 5.2.8

Hey Guys, I've done a bit of searching around and was unsuccessful in finding an ample solution. Specs are: OS X 10.5 with Apache/2.2.11 (Unix) mod_ssl/2.2.11 OpenSSL/0.9.7l DAV/2 PHP/5.2.8 Error: Fatal error: Call to undefined function zip_open() in /includes/admin_functions.php on line 18 Thank you for your help! ...

i can't understand "key=>value" this code in php ?

I got a question about the "$key => $value" in the code below... I looked it up in google but it didn't returned any results.. All I know is that "=>" is used in arrays like x = array('a' => 'b'). function _stripslashes_rcurs($variable,$top = true) { $clean_data = array(); foreach($variable as $key => $value) { $key = ($top) ...

Sort MPTT resultset into a multidimensional array PHP

I have been experimenting with the Modified Pre-Order Tree Traversal Pattern, my test case code is returning the results as expected however I am having trouble converting the 2D array into a multi-dimensional array to present it. Here is an example of a 3 level menu result, I need to convert this into a multi-dimensional array so that ...

Security considerations when creating an email form on the web

I know I have to consider about mail header injection, and are there more thing that I need to know before I make form mail thing? I want mail, and I feel that I have to set up form mail thing in my page, but I heard that mail thing is dangerous if I do not consider all security things. ...

Which SMTP server should I use, when develop im my PC?

Which SMTP server should I use, when develop im my PC? I currently use mercury, just because it's come with XAMPP. but mercury is too difficult for me. because it has too much settings. so I am seeking more easy to use SMTP soft. is there any easy SMTP soft there? ...

Randomizing -and remembering that randomisation- multiple choice questions in php.

Problem: I'm trying to code a multiple choice quiz for my fellow students -and primarily to aid my own learning- and so I'm creating a multiple choice web-based quiz using PHP (5.2.08) and MySQL (5.0.32) The questions table is: +----------+--------------+------+-----+---------+----------------+ | Field | Type | Null | Key |...

How can I not allow a user to go back after logout in PHP?

I just wrote a PHP login script, and what I'm trying to accomplish is that when the user click to the log out link, after they log out, regardless clicking the back button of the browser, they cannot access the page. Here is the logout function: //Start the Session session_start(); session_destroy(); header("location:login.php"); exi...

Converting int to string in PHP

Is there a way to convert integers to string in PHP? ...

Why not to use highest error reporting level in PHP?

I want you to give reasons why someone should not use the highest possible error reporting level in PHP? Ways to set highest level: PHP 5: error_reporting(E_ALL | E_STRICT); PHP 6: error_reporting(E_ALL); PHP all versions (as recommended for config files): error_reporting(2147483647); My experiences: there is no reason for l...

What is the best way to set up shared php script files on a webserver?

I'm running the same php script on many domains on an apache2 server. Only some of the files change between domains, and the rest are always the same. Right now, every time I set up a new domain, I copy all the files, but I'd really like to have these common files in one place so any changes would affect all domains. I've thought of usi...

Does PHP support asynchronous calls?

I am planning to build a web application and am going to host it. Since hosting cost less for php and it being similar to .net i am planning to go for php. I am basically a .net guy. But have no issues in learning php if it is similar to .net. Please give in your opinoins in doing so. Also please tell me if php supports asynchronous ca...

array_push vs $str .= in PHP

which one of the 2 have the best performance? In javascript I was heard douglas crockford say that you shouldn't use str += if you are concatenating a large string but use array.push instead. I've seen lots of code where developers use $str .= to concatenate a large string in PHP as well, but since "everything" in PHP is based on array...

problem in silent printing using php

I am doing work on php and want to do silent printing of pdf through php using network printer. I have tried: $filepath='./pdf/offer.pdf' $adobe_path='"C:/Program Files/Adobe/Reader 8.0/Reader/AcroRd32.exe"'; shell_exec ($adobe_path.' /t '.$filepath); This works but it doesn't work through other system on network printer. When I want...

XSL:T Benchmarking

How would you approach benchmarking the following XSL:T process. Testing environment: a Linux server running apache, php, and mysql that is only visible behind our network: (It is not outward facing, so It cannot be remotely accessed). Note: I have considered using AB(Apache Benchmark), but I am open to anything that is available in a...

obfuscate or encrypt some plain text data in PHP

I need to obfuscate or encrypt some plain text data in my php 5.2 application. I'd prefer a solution that would have input string and output string retain the same length. This does not need to extremely strong, as there are numerous other layers of security in place. Strong would be good, but this will just keep programmers/dba/suppo...

Populating an object's properties with an array?

I want to take an array and use that array's values to populate an object's properties using the array's keynames. Like so: $a=array('property1' => 1, 'property2' => 2); $o=new Obj(); $o->populate($a); class Obj { function Populate($array) { //?? } } After this, I now have: $o->property1==1 $o->property2==2 How...

Best practice for using fopen() or file_get_contents() to retreive web pages.

I am looking for some advice on the best way to retrieve information from a web page (my own site) and then search through that information to find a certain text. Keeping in mind that some of the servers that run PHP/Joomla do not have cURL enabled, I don't want to cause any unexpected errors. I've looked at both fopen() and file_get_...

executing php script from C program and store the results in to a variable

I would like to execute php script from the C Program and store the returning content in to a C variable. I tried like following but it doesnt works: C Code: printf("calling php function\n"); execl("/usr/bin/php -q", "/var/www/html/phpinfo.php", NULL); printf("End php function\n"); Php Code: <?php echo "hello"; ?> Envir...