function escCtrlChars(str)
{
return str.replace(/[\0\t\n\v\f\r\xa0'"!-]/g,
function(c) {
return '!' + c.charCodeAt(0) + '!';
});
}
Ok this is a function that replaces control characters from a string with another string starting and ending with !
My question is. Is c the character found while...
The PHP documentation says the following about the __call() magic method:
__call() is triggered when invoking inaccessible methods in an object context.
Is there a way I can have __call() called even when a method exists, before the actual method is called? Or, is there some other hook I can implement or another way that would provide...
Is it possible to query using Facebook Query Language when not currently logged in as a Facebook user? I'm trying to simply query when the user isn't logged in, so I can return their name, but instead of throwing up any errors, it just returns a response but the fields are blank.
Any ideas why this occurs, or do I need to look at storin...
Hi,
When I run the folowing code, I get this error:
Fatal error: SQL in /Users/allan/Sites/4is_site/casestudyall.php on line 105 (that's the last line in the code below.
Is there a problem with my query?
<?php
if (isset($_GET['pageno'])) {
$pageno = $_GET['pageno'];
}
else {
$pageno = 1;
}
$query = "SELECT count(*) FROM ...
I working mostly with DataMapper in Ruby and Merb, so im looking for PHP ORM that is similar to DataMapper. Any good ones?
...
I have a multi dimensional array. The only actual values (other than other arrays) in there are numbers. By default, they are all 0.
I would like to know is there an easy way to determine if the array has a value other than 0 in it.
I know I could build something recursive, but I want to know if I could leverage array_map() or somethin...
I'm having a lot of difficulty matching an image url with spaces.
I need to make this
http://site.com/site.com/files/images/img 2 (5).jpg
into a div like this:
.replace(/(http:\/\/([^\s]+\.(jpg|png|gif)))/ig, "<div style=\"background: url($1)\"></div>")
Here's the thread about that:
http://stackoverflow.com/questions/1066697/rege...
Say this is my string
$string = 'product[0][1][0]';
How could I use that string alone to actually get the value from an array as if I had used this:
echo $array['product'][0][1][0]
I've messed around with preg_match_all with this regex (/\[([0-9]+)\]/), but I am unable to come up with something satisfactory.
Any ideas? Thanks in a...
I have a XSLT 1.0 file to transform a XML file using XSLT 1.0. It works fine with IE 6.0, Firefox 3.0.11. However, PHP 5.2.6 XSL XSLTProcessor (providing XSLT 1.0) and Qt C++ QXmlQuery (providing only XSLT 2.0) give blank output.
I'm thinking of 2 ways:
Convert it to XSLT 2.0
Extract Firefox part to parse.
I prefer the 1st one. Plea...
PHP: what is the difference between
$varName = "$var \n";
from that with a period:
$varName. = "$var \n"?
quite confusing.
...
Hi,
I'm trying to integrate a js slideshow fade effect with php. It was working fine, but not anymore, I'm not sure what has changed. Now it shows an alert that says "No contents found". The connection to the database should be ok, there is content being displayed in other areas of the page.
Any ideas where I've gone wrong?
<script...
Okay, here's what I'm trying to do: I'm trying to use PHP to develop what's essentially a tiny subset of a markdown implementation, not worth using a full markdown class.
I need essentially do a str_replace, but alternate the replace string for every occurrence of the needle, so as to handle the opening and closing HTML tags.
For examp...
How to pass information in this flow:
Flash(AS3) -> PHP, using XML -> Database(mysql)
Can anyone write a simple code for that?
Thanks.
...
If we don't use exec("ls -l") in PHP, but use readdir() or scandir() to get the list of files, and want to list the file sizes and maybe modification date as well, do we need to call stat() 1000 times if there are 1000 files? Is there a simpler or faster way?
Will calling stat() 1000 times hit the file system a lot? Or maybe the OS wi...
We need to create a file management interface that integrates with the clients current website built on cakephp.
The file manager must only let the users see the files that they have permissions too.
The user will be able to upload files(of any size) and have other users download those files (if permissions allow).
This is no problem ...
I have a folder of PHP scripts, they are mostly utility scripts. How to share those scripts among different PHP applications so that reuse and deployment are easy?
I would have to package my app into an installer, and let the user install it.
I could put the lib and hardcode the include path, but that means I haven to change the PHP c...
I've just released a PHP framework called EuropaPHP (http://europaphp.org/). I was wondering if I could get some feedback from of you guys whatever it may be. Let me know what you like about it, what you don't like about it; whatever.
It's based on similar coding conventions to that of the Zend Framework and as a result, the Zend Framew...
Hi,
Which are the user friendly frameworks for building personal sites? Specially if that comes with little programming knowledge. And integrated jquery will be great. python or php based framework will do better.
I tried wordpress and joomla! But those are far more complex for a simple personal site with personal blogging, live comment...
Hi,
I have used valgrinds massif tool to monitor memory usage in the past.
Does anyone know how to capture memory use of php processes that are spawned on a linux lighttpd server?
I have found that Valgrind can not attach to a prerunning process (and I would not know the PID of the php process before hand anyway)
I only see lighttpd...
I've just written the easiest script in the world, but still I can't get it to work, and it's mighty strange. Here's the deal, what I want to do is to use jQuery to catch some input field values and serialize them with jQuery's serialize(); I then send the serialized string to the server to unserialize it. Here's the output I get from th...