php

How to, Take a text file and wrap every word with a tag <v> </v>

I want to take plain text and wrap every word with an element like so <v>Archer</v> <v>aŭtomobilis</v> <v>fore</v> <v>de</v> <v>antaŭkristnaska</v> <v>festo</v> <v>en</v> <v>suda</v> <v>apudurbo</v>. <v>Malgraŭ</v> What is the best way to do this in php thanks. ...

accessing php session from a command line java program

Hello, I am designing an enterprise security server for our company - we own many different applications, most written in java and a few written in PHP. I could provide a remote API that would give each application access to the server. I could also create 'agents' that each application could include that would do all the work for the...

PHP is there a built-in function to render ' as &rsquo; etc

is there a built-in function to render characters like ' as identities () ? also, is it unsafe to output raw characters (e.g ') in the html? thanks. ...

PHP/Drupal Gotchas?

Hi guys, I'm starting to switch from ASP.NET to PHP, and also Drupal. In ASP.NET, if the user has Cookies or Javascript turned off, this can introduce a lot of unforseen problems and complications. Most users have the default settings (on,on) but when they don't, mud hits the fans and it can be confusing as to where the "bug" is. What ...

PHP tutorial that is security-, accuracy- and maintainability-conscious?

Colleagues often ask me: “bobince”, they say*, “I want to learn PHP, but I know you're always ranting on about poor code which is full of errors and security holes. That's why I normally don't like talking to you really. But, I'm looking to learn PHP now and I'd like to be able to write good code. Where's a tutorial that will teach me ho...

Inserting data in oracle database using php.

The following code is generating this Warning: oci_execute() [function.oci-execute]: ORA-00911: invalid character in F:\wamp\www\SEarch Engine\done.php on line 17 the code is... <?php include_once('config.php'); $db = oci_new_connect(ORAUSER,ORAPASS,"localhost/XE"); $url_name=$_POST['textfield']; $keyword_name=$_POST['textarea'];...

yum install php-pear* on centos

Hi, I'm trying to install pear on my centos. I've used "yum install php-pear*" to install pear and it seemed to install with success. No errors. I restart my server. However when I check out phpinfo(). I see that my php is still built using "--without-pear". Isn't yum supposed to rebuild my php with pear? What would be possibly going...

Wrap text - case insensitive with php

If I search for tOm ArNfElD and the $variable is "Tom Arnfeld", I get great results form LIKE in MySQL (which is case-insensitive). How could I wrap the matched text in the $variable with a <span></span> to highlight to what part of the search matched the query? I need to retain the original case of the $variable. ...

Does unsetting an array of objects unset just the array or also all the objects?

I have an array of objects. If I call unset($array), will it unset all objects in the array AND the array or just the array? Let's assume these objects are referenced nowhere else. ...

php: Grabbing stdout output data from cli tools?

Is it possible to grab the stdout output data from command line tools in php? Example: I want to upload a dynamically server-created mix of audio files to the client. The SOX tool lets me mix the input mp3s and send the result to stdout pipe. Could I grab this mix and instantly upload it, without the need of first saving it as a tempf...

Does reassigning an array to another array free memory originally used by the array?

My class has a member variable array, items. Periodically I reassign the array to be the value of another, temporary array, like this: $temp = array(); $temp[] = new Object(); $temp[] = new Object(); $temp[] = new Object(); ... etc. $this->items = $temp; So, could I have a memory leak? By reassigning the value of $this->temp to a new...

How do I echo selected in a while loop?

Hello, I have a blogs and questions section on my site that has categories. When a user composes a question or a blog, there is a drop down menu that allows you to choose your category. When you edit either of these you have the option of changing your category via the dropdown. When you go to edit a blog,the category drop down is a stan...

Is there a way to use SVN for web development in a Mac shop that uses coda?

So we are pushing to create good processes in our office. I work in a web shop that has been doing web sites for over a decade. And we don't use version control. I know! It's bad, not my fault. I'm the guy with a SoftE background pushing for this at a minimum. The tech lead has been looking into it. We all use Mac workstations and ...

Displaying multidimensional array in php...

Hi, I have an array like this: $tset = "MAIN_TEST_SET"; $gettc = "101"; $getbid = "b12"; $getresultsid = "4587879"; $users["$tset"] = array( "testcase"=>"$gettc", "buildid"=>"$getbid", "resultsid"=>"$getresultsid" ); Arrays in PHP is confusing me. I want to displ...

PHP: Problem merging arrays

OK I have this function (I got as the answer to this question) that merges an array like so: Functions function readArray( $arr, $k, $default = 0 ) { return isset( $arr[$k] ) ? $arr[$k] : $default ; } function merge( $arr1, $arr2 ) { $result = array() ; foreach( $arr1 as $k => $v ) { if( is_numeric( $v ) ) { ...

PHP math question

Lets say I divide 14 / 15 times it by 100 to get the percentage which is 93.33333333333333 how can I display it as 93.3% using php? Here is the code. $percent = ($avg / 15) * 100; ...

Sorting an array of SimpleXML objects

I've read what I've found on Stackoverflow and am still unclear on this. I have an array of SimpleXML objects something like this: array(2) { [0]=> object(SimpleXMLElement)#2 (2) { ["name"]=> string(15) "Andrew" ["age"]=> string(2) "21" } [1]=> object(SimpleXMLElement)#3 (2) { ["name"]=> string(12) "Be...

Select over multiple databases

In a project at work i have to improve performance. The data of the app is spread over many databases. I was told that is better for organizing the data. Whatever. Is there a performance penalty when i do a select over some tables spread on several databases instead of a select on those tables in one database? ...

Quantity Conditional

Here's one that's got me stumped. Working in PHP5. I am building a store application for a client that makes use of a web service from a larger agency as he is a broker. This web service requires that items for purchase by end users be of a certain quantity or else the order will be considered ineligible for purchase. I must make dro...

put multipart data with curl with different content types

Hello, I want to ask this question because the php documentation doesn't mention it How would one put xml data and binary data together? $imagecontent = @file_get_contents($imagelocation); $xmldata ="<xml></xml>"; $headers = array("MIME-version: 1.0"); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PUT"); curl_setopt($ch, CURLOPT_HTTPHEADER,...