php

Finding the install path of a utility with PHP on linux/freebsd/macosx

I have a PHP code block I've written that uses imagemagick's convert program (called through exec()) to create thumbnails of uploaded images (originally we tried using the PHP module calls, but kept running into memory errors). Of course to do this I have to have the full path to convert, which varies from system to system (on my mac it...

Clover coverage with Phing

Is there a way to get Phing to output it's coverage report in clover format? I know phpunit has --coverage-clover but I don't know how to enable this option from Phing. I do not want to manually use the <exec command - it defeats the point of Phing. I am using Phing 2.4RC2 Thanks. ...

how to echo special characters like åäö with utf8

specialcharacters åöö in the database cant be shown when i retrieve the rows and echo it. what can i do to have them shown propertly? ...

What do you have in your Model class?

What do you have in your model classes. Generally if i use any framework or any library (Zend Framework) , my classes only have variable which is table name . I know that in complicated applications models have lots of thing to do , so i want to know what these jobs are. Maybe instead of using library`s general select function ,you cre...

show new lines and spaces?

im coding a guestbook and i want new lines and spaces to be shown when i show the posts? when i post a thread now everything is shown on one line. help! ...

How do I use regex to get Artist and Title from an MP3 filename?

Hi, Thanks for taking the time out to read. I have a folder of MP3 files, that I want to use PHP to get the Artist and Title out, as the ID3 tags are non existent. An example: 01. Wham - Last Christmas.mp3 02. Mariah Carey - All I Want For Christmas Is You.mp3 03. Band Aid - Do They Know It's Christmas Time.mp3 I am sure it's poss...

Zend_Search_Lucene & accents

Hi Is it possible search accented text with Zend_Search_Lucene? I indexed accented text but the search doesn't find it. A roundabout solution can be that I deaccent the text before indexing and also deaccent the query string. But it doesn't seam to be an elegant solution. Any idea? ...

Any PHP MVC framework planning to use 5.3 features?

I would like to get started with PHP, and 5.3 release seems to bring many nice features (namespaces, lambda functions, and many others). I have found some MVC frameworks, and some of them support only PHP 5: PHP Frameworks PHP MVC Frameworks Model–view–controller on Wikipedia but can anyone recommend one of those MVC frameworks that...

php pushing pattern from array1 to array2

I have an array that looks something like this array(7) { [0]=> "hello,pat1" [1]=> "hello,pat1" [2]=> "test,pat2" [3]=> "test,pat2" [4]=> "foo,pat3" [5]=> "foo,pat3" [6]=> "foo,pat3" .... } I would like to push it into another array so the output of the array2 is as follow: array(7) { [0]=> "hello,pat1" [1]=> "tes...

image ontop of an image in php

Here is a link to the page http://www.true-gamerz.net/test2.php if you look at the image, The rank image is transpent but it dose not show it on the screen dose anyone know why this is happen? Here is the code <? header('content-type: image/png'); $watermark = imagecreatefrompng('images/ranks/ranks_18.png'); $watermark_wi...

problem with if statement used to determine function return

Im using an if statement to determine what to return in a function, but it seems to be not working the way i want it to. function DoThis($dogs, $cats){ // do something with dogs, pet them perhaps. $reg = $dogs[0]; $nate = $dogs[1]; if($cats = "dave"){return $reg;} if($cats = "tom"){return $nate;} } $cats is a string (if that helps)...

javascript within php

Hi, The following code does not work for me <body onload = "<?php foreach($arr as $a){ echo "<script language = javascript> popup_show(\''.$a.'\', \'popup_drag\', \'popup_exit\', \'screen-top-left\', 20, 20) <script>"; } ?>" > I even tried this with an alert . <body onload = "<?php foreach($arr as $a){ echo "<script language = j...

.htaccess URL rewrite help!

Hi guys, I am using .htaccess and mod_rewrite in my little PHP framework. It's working nicely, but I want to expand on just having it redirect everything to index.php. My directory structure is something like this (obviously simplified) apps media system -- admin jscript templates My current rewrite rules is: RewriteEngine On Rewri...

LIKE operator with $variable

This is my first question here and I hope it is simple enough to get a quick answer! Basically, I have the following code: $variable = curPageURL(); $query = 'SELECT * FROM `tablename` WHERE `columnname` LIKE '$variable' ; If I echo the $variable, it prints the current page's url( which is a javascript on my page) Ultimately, what I...

php function that separates a string into different strings?

lets say i have this string here: $string = 'hello my name is "nicholas cage"'. i want to separate the words into difference strings like this: $word1 = 'hello'; $word2 = 'my'; $word3 = 'name'; $word4 = 'is'; $word5 = 'nicholas cage'; For fhe first 4 words I can use explode. but how do i do with word5? I want the first and last name ...

Check database stores includes same units from session PHP

Hey I'm trying to check sessionbasket before buying (and check if database store includes same units from session ) foreach($_SESSION['cart'] AS $key => $qty){ $sizes_id[] = $qty['units']; } output from session: Array( [0] => 1 (units) [1] => 5 (units) ) lets assume that there is max 2 units in db, and 5 in session....

What to learn after PHP? Scala or Clojure?

I have a heavy web dev background with PHP. My reasons for learning a functional programming languages are: to improve my programming skills. It was heavily suggested that learning a FPL helps. this has high priority because I want to be better and better. learn a general purpose programming language to solve tasks like scripting (OS s...

apps directory for symfony missing

Got this error following this tut http://www.symfony-project.org/getting-started/1%5F2/en/03-Sandbox Warning: require_once(...\sf_sandbox\apps\frontend\config\config.php) [function.require-once]: failed to open stream: No such file or directory in ...\sf_sandbox\web\index.php on line 8 Why ? ...

php take users input write to file, and echo out the file for user to view

How do I set this up such that when a user enters his first name and last name, I write it to a .html file and then give the user a link to view the information that they have just entered? I know I could just echo that out like I am already doing with $_POST['userfName'] after Welcome, but I just want to write to some .html file and ec...

how to check connection to php page

Hi I might have written the title wrong. Sorry for that. I just wonder if there is a way to check users connection to a php page. For example, i have a php page called "download.php" and this page lets user to download sth and insert this action to mysql, like that $query = "INSERT INTO bla bla "; $result = mysql_query($query); hea...