Can you use two regex in preg_replace to match and replace items in an array?
So for example:
Assume you have:
Array
(
[0] => mailto:[email protected]
[1] => mailto:[email protected]
[2] => mailto:[email protected]
[3] => mailto:[email protected]
[4] => mailto:[email protected]
...
I have several PHP files include()ing other files from several other directories.
In one of those included files: foo/bar.php, I want bar.php to include 3 other files contained in the directory foo. However bar.php is actually included by another file in another directory, which is included by yet another file, and so on.
If I did:
in...
I have a php page. This has multiple images which looks like tabs. With in this php page i have a div which will load different PHP pages on click of different images i mentioned before. This is done using Ajax. This much of it works fine with no page reload. This is done to simulate the tab operation without page reload. This much of it...
Hello,
I have developped a PHP system that is using Javascript with the ExtJS library, which provides graphic components in Javascript. So I have a grid which is refresh every 3 minutes by an AJAX call which reloads the grid. Everything works fine on all computers, except for this one computer where, once in a while when reloading th...
Hi,
I'm trying to query a MySQL database using an array but I'm having trouble!
I have a table called clients, I want to be able to select 'name' from all rows whose 'sector' column is equal to $sectorlink.
I then want to put all the names into an array so I can perform my next query: select all rows from another table whose 'client...
check it,
i have this table
tablename: reports
id (AI)
content (varchar),
contentID (int),
checked (tinyint)
if (isset($_GET['reportPost'])){
$query = mysql_query("select * from reports where contentID = $_GET[reportPost]");
$report = mysql_fetch_assoc($query);
if (!mysql_num_rows($query) && $report['checked'] == 0) {
echo 'T...
I use camel case which has the first letter of all variable names, functions, etc lowercased. But the class names are capitalized. Should I use:
class Foo
{
function foo()
{
}
}
or :
class Foo
{
function Foo()
{
}
}
Which is a better convention? I'm confused.
...
In my .htaccess file I have defined the following rule to make my register page URL as http://example.com/register/
RewriteRule register/ /register.php
The above rule is perfectly fine but I can access my register page from http://example.com/register/ as well as from http://example.com/register.php.
I don't want that user will be ...
Hi guys, I'm generating an image out of text using php. My code works perfectly on my localhost and the text is generated fine. However on my online host it doesn't generate the whole text just bits and pieces of it. Like if I were to pass the text 'This is some text' to it - it would generate just maybe an S or t.
The code is fine as i...
I have a web service, defined(WSDL) and implemented in PHP. This one is relatively simple, important bits defined as the following:
<message name='registerAccountRequest'>
<part name='key' type='xsd:string'/> <!-- key -->
<part name='data' type='xsd:array'/> <!-- account data -->
</message>
<message name='registerAccount...
After having installed the HTTP extension from PECL, I expected Zend Studio 6 to recognize the provided HTTP* classes and for code completion to be made available. This is not the case, however. How do I get Zend Studio to recognize classes provided by PHP extensions? Specifcally, I want to be able to use code competition on these classe...
I want to make movement such as the tail command with PHP,
but how may watch append to the file?
...
I have an url like this:
http://www.w3schools.com/PHP/func_string_str_split.asp
I want to split that url to get the host part only. For that I am using
parse_url($url,PHP_URL_HOST);
it returns www.w3schools.com.
I want to get only 'w3schools.com'.
is there any function for that or do i have to do it manually?
...
hi guys,
any help for this...
Code:
<a href = 'ymsgr:sendim?your_yahoo_id'>Send me a message</a>
How should i know if the email field is yahoo mail address?
...
I have a text field and two checkbox, i need to list users based on the selection.... can anyone show me an example....
...
Is there any book about modern PHP (like 5.2 + mysqli or PDO) for beginners with good exercises (for ex., good exercises are in "Learning Perl", which is one of the best books for beginners)?
P.S. (considering some answers I got on IRC): it should not be a tutorial, it should not be a video tutorial, it should not be outdated (like usin...
For a simple web application, I'd like to be able to take advantage of several UNIX features that are stable, have a long history, and are well proven in production, rather than having to write my own code. Take users, for example. Rather than having an entire user, group, permission infrastructure in my webapp, I'd like to be able to si...
I would like to create a pagination system for comments in my website.So far, I have been able to create pagination using php/mysql and html but the page has to refresh every time we click on the next button(for the next set of comments) or previous or a particular page....
As far as my knowledge of jquery is concerned I am thinking th...
I'm wanting to get the filepath ie "/sites/default/files/myfile.pdf" for my file uploads.
I'm using the below
$row['node_data_field_factsheet_field_factsheet_data']
this returns "a:1:{s:11:"description";s:0:"";}"
How do i get the actual path?
here is my sql statement.
SELECT node.nid AS nid,
node_data_field_factsheet.field_factshee...
Hi
how do I keep a certain number of elements in an array?
function test($var)
{
if(is_array($_SESSION['myarray']) {
array_push($_SESSION['myarray'], $var);
}
}
test("hello");
I just want to keep 10 elements in array $a. So when I call test($var) .. it should push this value to array but keep the number to 10 by remo...