php5

Compile time error plugins for Php

I know that php is a scripting language like perl.python. But, is there a eclipse plugin which gives a error when a function taht is called doesn't exists. Or when a variable which is defined in the doesn't exists. There are too many careless mistakes that are happening with me in a huge project. I miss java for this. Any compile tim...

Memory leak with preg_replace

I'm using the preg_replace function to replace accents in a string, I'm working with UTF-8. I have incurred in what seems to be a memory leak, but I can't isolate the root cause, my code is rather simple: preg_replace( array_keys($aToNoAccents), array_values($aToNoAccents), $sText ); where $aToNoAccent...

Magento dispatching outside application

Hi all, I'm trying to figure out how exactly Magento's dispatching system works. I want to dispatch a certain part of the layout (e.g. the body) from outside the application directory. What i have so far; <?php $app = Mage::app(); $myRequestUri = '/checkout/cart'; $front = $app->getFrontController(); $request = ...

PHP DOM Get Tag Before N-th Table

Let's say the HTML contains 15 table tags, before each table there is a div tag with some text inside. I need to get the text from the div tag that is directly before the 10th table tag in the HTML markup. How would I do that? The only way I can think of is to use explode('<table', $html) to split the HTML into parts and then get the la...

how images/files are stored in hard disk and how orkut or any other sites links are organised..is it in differnt tables ???

Friends today i was thinking about orkut structure... There are profile,images,videos,scraps.... I think at server side there must be differnt tables like profile table,image table,video tables,scrapbook table etc.. in which each user must have his data with unique username... Now when user login and clcik on profile link data is retri...

antiword is not displaying resume data not even a single word

HI I want to open a doc file in the same format as it was uploaded in php so i think for this antiword will be used i tried but it is not working.I am working on windows xp and i downloaded antiword from http://www.informatik.uni-frankfurt.de/~markus/antiword/ I put extracted files into htdocs and then tried to call antiword by $content...

saving mySql row checkpoint in table ?

hello, I am having a wee problem, and I am sure there is a more convenient/simpler way to achieve the solution, but all searches are throw in up a blanks at the moment ! I have a mysql db that is regularly updated by php page [ via a cron job ] this adds or deletes entries as appropriate. My issue is that I also need to check if any...

In PHP, are there any advantages to using forward_static_call_array() instead of call_user_func_array() when dynamically calling a static method?

Specifically, is one more efficient than the other? ...

Quality PHP code/snippet repositories?

Does anybody know any larger repositories of high-quality PHP classes and snippets? The only site I know is phpclasses.org, and while I mean no disrespect to its owner/s, its design looks pretty outdated (already has for a looong time) and the "social control" in terms of people reviewing and commenting on code is weak: There are lots an...

Best way to time a PHP script

What is the best way to see how long it takes for your PHP script to run? I was thinking something like this: $start_time = time(); //this at the beginning $end_time = time(); //this at the end echo = $end_time-$start_time; What do you all think? But how can I make it into something that is readable to me and make sense to me? ...

Make one field unique depending on another field

hello there.. I have the following MySQL table.. userid - foreign key date - primary key slot1 - 1st free slot slot2 - 2nd free slot slot3 - 3rd free slot slot4 - 4th free slot slot5 - 5th free slot slot6 - 6th free slot slot7 - 7th free slot slot8 - 8th free slot All the slots are for the same day, so the user can input di...

Extended PHP ArrayObject Does Not Work Properly

I'm trying to extend the SPL ArrayObject but I've hit a little snag. Using an unmodified ArrayObject, this code works: $a = new ArrayObject(); $a[1][2] = 'abc'; print_r($a); yielding this output: ArrayObject Object ( [storage:ArrayObject:private] => Array ( [1] => Array ( [...

Simple Insert works with phpmyadmin but not with php

im trying to insert this query with mysql_query INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,1,1) ; INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,2,1) ; INSERT INTO um_group_rights (`um_group_id`,`cms_usecase_id`,`um_right_id`) VALUES (2,3,1) ; INSERT INTO...

Can user defined variable be used with ADODB connections from PHP5 to a MySQL4.x server?

I'm trying to execute a SQL statement using the ADODB PHP library against mySQL4.1 : $rs = $db->execute("set @name = ?; select @name", array('test')); but it does not seem to like this. Is it possible to use variables with prepared statements? ...

SWFupload problems

Hello all, I use SWFupload for my project but I have a small problem. When I upload a picture locally, everything works fine. But when I use it online, it stops uploading when it hits this : SWF DEBUG: Event: uploadProgress: File ID: SWFUpload_0_0. Bytes: 120133. Total: 120133 I can't find the problem. Can somebody help me here? S...

How can this xpath query (PHP) be more flexible?

I'm parsing an XHTML document using PHP's SimpleXML. I need to query a series of ul's in the document for a node containing a specific value, then find that node's parent's direct previous sibling... code will help explain! Given the following dummy xhtml: <html> <head></head> <body> ... <ul class="attr-list"> <li>Active Life (ac...

PHP throwing XDebug errors ONLY in command line mode...

Hey, all! I've been having a few problems running PHP-based utilities within the command line ever since I enabled the XDebug. It runs just fine when executing script through a browser, but once I try an execute a script on the command line, it throws the following errors: h:\www\test>@php test.php PHP Warning: PHP Startup: Unable to ...

Extending classes in PHP

When extending classes in Java, class name ambiguity is avoided by the usage of qualified package names in the import statements. For example: Say I want my controller to extend Spring's MultiActionController - I'll import the same from the standard Spring package. This also prevents me from extending Mike's or Perry's MultiActionContr...

jquery array of checkbox not sent to php file

to gather the value from the check boxes: var filtersArray = $("input[@name='filters']:checked").map(function(i,n){ return $(n).val(); }).get(); Posting to php file $.post("php/performSearch.php", { keywords: $('#keywords').val(), 'filters[]': filtersArray}, function(data){...

fpassthru problem in PHP5

My web host has a "process killer" which terminates any process running longer than about 5 minutes, so my download script can't run for that long. I thought I'd use fread-print for a few seconds, just to catch if the user aborts the download initially and then use fpassthru to to dump the rest of the file. ob_end_clean(); $file = fope...