php

How to get the previous value from incrementing variable in for loop?

In My last post I asked : How to create dynamic incrementing variable using "for" loop in php? like wise: $track_1,$track_2,$track_3,$track_4..... so on.... whose answer I selected as for($i = 0; $i < 10; $i++) { $name = "track_$i"; $$name = 'hello'; } and for($i = 0; $i < 10; $i++) { ${'track_' . $i} = 'val' } Now, What ...

PHP and Java interoperablity

I am working on windows using tomcat 6 and PHP/Java Bridge. I know how to access a Java file from PHP but how do we do it the other way i.e accessing PHP from Java <?php require_once("java\Java.inc"); $systemInfo = new Java("java.lang.System"); print "Total seconds since January 1, 1970: ".$systemInfo->currentTimeMillis(); ?> Also ho...

How do I replace characters not in range [0x5E10, 0x7F35] with '*' in PHP?

I'm not familiar with the how regular expressions treat hexadecimal, anyone knows? ...

PDO / Php Problem with LIKE statement and special characters

I've already checked answers to questions like this one (How do I create a PDO parameterized query with a LIKE statement in PHP). I've ended up to this solution: $sql = "SELECT count(*) ". "FROM avs_souscript ". "WHERE num_certif =\"\" ". "AND date_annul=\"\" ". "AND user=:sess_user ". "AND user!...

Make an array of two.

Hello! I'd like to make an array which tells my site's pages where to show in PHP. In $sor["site_id"] i've got two or four chars-lenght strings. example: 23, 42, 13, 1 In my other array (called to $pages_show) i want to give all the site_ids to an other id. $parancs="SELECT * FROM pages ORDER BY id"; $eredmeny=mysql_query($parancs) o...

genrating xlsheet with mysql but also contains html code in xl sheet need remove html code

following is the code for getting xlsheet from mysql ?php if($_POST['Submit']=='Generatexml') { $tblname=$_GET['genratexml']; //mysql_connect("localhost","root",""); //mysql_select_db("hitnrunf_db"); global $obj_mysql; $result = mysql_query("SELECT * FROM tbl_js_login"); while($row = mysql_fetch_array($result)) { $csv_outp...

Split string into smaller part with constrain [PHP RegEx HTML]

Hello, I need to split long string into a array with following constrains: The input will be HTML string, may be full page or partial. Each part (new strings) will have a limited number of character (e.g. not more than 8000 character) Each part can contain multiple sentences (delimited by . [full stop]) but never a partial sentences. ...

Cannot use Debug on Zend

Greetings, I done the debugger setup on a WAMP server... What happens is that it says that a timeout error ocurred when the debug server attempted to connect the following IP/Host 127.0.0.1 I already added to the php.ini zend_debugger.allow_hosts=127.0.0.1 zend_debugger.expose_remotely=always this is running on my machine... I don't k...

Why use Nusoap rather than PHP SOAP ? Any benifits ?

As far as i have scourged the web, i can see an abundance of articles on how to setup Nusoap and use it to setup a soap server/client in PHP. However, none of them seem to point to any advantages of using it than PHP's own native SOAP library. Can anyone tell me what are the pros/cons between : Nusoap PHP SOAP PEAR::SOAP Zend SOAP...

[WEB] Local/Dev/Live deployment - best workflow

Hello, situation We our little company with 3 people, each has a localhost webserver and most projects (previous and current) are on one PC network shared disk. We have virtual server, where some of our clients' sites and our site. Our standard workflow is: Coder PC → Programmer localhost → dev domain (client.company.com) ...

remove utf-8 figure spaces with php

I have some xml files with figure spaces in it, I need to remove those with php. The utf-8 code for these is e2 80 a9. If I'm not mistaken php does not seem to like 6 byte utf-8 chars, so far at least I'm unable to find a way to delete the figure spaces with functions like preg_replace. Anybody any tips or even better a solution to this...

PHP save a page then redirect to previous page(ajax)

Dear all, I would like to ask for how to redirect to previous page (ajax paging). Example, Let's say currently I am in page 5, then I click on one record, after I edit it, I would like to go back to that page 5 not page 1. The problem is my paging is using ajax, http://domain/photo/#5 I try to use $_SERVER[http_referer], but I only ...

How do I get number of characters in PHP?

mb_strlen only gives number of bytes,not what I wanted. It should work with multibyte characters. ...

PHP preg_match to get function-like string

Hi to all, if I have a string like 'foo(bar)', with the following code i can almost parse it the way i want: $results = array(); preg_match( "/\w*(?=(\(.*\))?)/", 'foo(bar)', &$results ); print_r($results); /* Array ( [0] => foo [1] => (bar) ) */ How can I modify the regex to have bar instead of (bar)? Thanks ...

PHP/Java bridge problem

I am using tomcat 6 on windows. Here is the code I am testing. import java.io.ByteArrayOutputStream; import java.io.Closeable; import java.io.StringReader; import javax.script.Invocable; import javax.script.ScriptEngine; import javax.script.ScriptEngineManager; /** * Create and run THREAD_COUNT PHP threads, concurrently accessing ...

Why is POST data lost in facebook iframe form post?

I have tried various methods to try to retrieve the POST data from the $_POST variable, but it is always empty when I post the form to the iframe in my facebook app. I have googled everything I could find and have tried the following methods. P3P headers, posting to the canvas url, posting to a direct url on my site with fb_sig* query ...

Generate MySQL data dump in SQL from PHP

I'm writing a PHP script to generate SQL dumps from my database for version control purposes. It already dumps the data structure by means of running the appropriate SHOW CREATE .... query. Now I want to dump data itself but I'm unsure about the best method. My requirements are: I need a record per row Rows must be sorted by primary ke...

How to make sure the value is reset in foreach loop in PHP

Hi all, I was writing a simple PHP page and a few foreach loops were used. Here are the scripts: $arrs = array("a", "b", "c"); foreach ($arrs as $arr) { if(substr($arr,0,1)=="b") { echo "This is b"; } } // end of first foreach loop and I didn't use ifelse here And when this foreach ends, I wrote another foreach...

How to replace <span style="font-weight: bold;">foo</span> by <strong>foo</strong> using PHP and regex?

I have a string like this: <span style="font-weight: bold;">Foo</span> I want to use PHP to make it <strong>Foo</strong> …without affecting other spans. How can I do this? ...

PHP-based graphing script recommendation

Can anyone recommend a easy to use php-based graphing script? I've been looking at PHPGraphLib but I imagine there tonnes out there. Commercial or GNU, doesn't matter. Only requirement is image based charts as these will be e-mailed/printed. (no flash) ...