How are foreach executed in PHP?
foreach(func() as $item)... The above will only call func() once,but why?What's happening exactly? ...
foreach(func() as $item)... The above will only call func() once,but why?What's happening exactly? ...
An inexperienced PHP question: I've got a PHP script file that I need to include on different pages lots of times in lots of places. I have the option of either breaking the included file down into several smaller files and include these on a as-needed basis... OR ... I could just keep it all together in a single PHP file. I'm wonderi...
href=" <?php $zzz_stylesheet = "http://127.0.0.1/www/wordpress/wp-content/themes/mytheme/style.css"; echo str_replace(".css","-mytheme.css",$zzz_stylesheet); ?> works but href=" <?php $zzz_stylesheet = bloginfo('stylesheet_url'); echo str_replace(".css","-mytheme.css",$zzz_stylesheet); ?> does not work. Why? bloginfo is a functi...
EDIT: Ok I have some data (A ton of data) being pulled from a MySQL DB Table, nothing special about how the data is entered. When parsing the data and re-displaying it to Firefox this symbol � shows up. When I compare it to the DB entry it looks like a space (Nothing special). I'm using all the default PHP/MySQL settings. Doing a var_d...
Hi. on my website I want to be able to show a list of files, photos to be exact, and then have them individually linked, so that when someone clicks on one, they can download it. i'm trying this: [code] $path = "c:/users/jon/desktop/pictures"; // Open the folder $dir_handle = @opendir($path) or die("Unable to open $path"); ...
I tried gettext, but my free hosting doesn't allow it. I thought about Zend_translate, but I didn't want to use elements from frameworks since my page is mostly static. So, I ended up with this tutorial: http://www.bitrepository.com/php-how-to-add-multi-language-support-to-a-website.html Where the author only use basic php (not sure),...
Hello, I am using below statement to return the directory name of the running script: print dirname(__FILE__); it outputs something like this with back-slashes: www\EZPHP\core\ezphp.php Question: Is a path with back-slashes acceptable across all major operating systems? If not, how should i construct the path either with slashes ...
Im trying to create a drop down list/menu of users from my SQL database table. Could anyone help me with the code please? The code below is just for a normal list with options 1 & 2. How do i make the list retrieve all the items in a specific table using html/php/sql. Sorry im not very experienced with this, thanks in advance. <select n...
Unfortunately I cannot provide any code examples, however I will try and create an example. My question is about Objects and memory allocation in PHP. If I have an object, lets say: $object = new Class(); Then I do something like $object2 = $object; What is this actualy doing? I know there is a clone function, but thats not what I...
I have a table which contains related records (multiple revisions of the same record). Each record has a string field that resembles a date (date, time, and microtime). I want to select all records that are older than a specific date. If a record has a related record newer than the specific date, I do not want to select any of those rela...
does anyone know if there's a class out there that parses courier mailboxes (ie: courier imap mail server)? returning lists, and parsing individual messages? this is not a protocol issue, i'm not interested in connecting to a remote mail-server. rather, i'm interested in manipulating the local mail-server via filesystem. In particular,...
I want to replace the class with the div text like this : This: <div class="grid-flags" >FOO</div> Becomes: <div class="iconFoo" ></div> So the class is changed to "icon". ucfirst(strtolower(FOO)) and the text is removed Test HTML <div class="grid-flags" >FOO</div> Pattern '/class=\"grid-flags\" \>(FOO|BAR|BAZ)/e' Replacement ...
Now I have fixed the problem the T_ELSE parse error is not displaying anymore, But then how can I direct the code to display the if or the else? Well users are going to come from either page1.php or page2.php url coming from page1.php cart.php?ids=1 url coming from page2.php cart.php?idc=1 for instance if the url is coming from pa...
When it's pulled from the db, it comes out like this: 2010-02-28 10:00:00 I'm formatting it (yes, I know that it's better to just do it in the query, but I don't have that option right now): date('l F d, Y h:m A', strtotime($row['start'])); But, no matter what, it outputs like this: Sunday February 28, 2010 10:02 AM Any idea why i...
I've been exploring ideas how to create thumbnails from a user upload and store them in a directory and then use that thumbnail to display the original. I've been reading posts about phpthumb(), wideimage, imagemagick, and php's GD. I need some advice on which would work best for my requirements. When the user uploads a source photo...
I'm using $_SERVER['DOCUMENT_ROOT'] for my include paths so files will figure out where they are running from (i.e. whether they're on live or staging) and it works fine, except for scripts that are run by cron in which I have to hardcode the path. Is there another variable I could use that could work from both cron and the browser? ...
I'm using Macports for my PHP development. I thought that everything associated with Macports should be located under/opt/local, but I can't load the PEAR::Mail_Mime package I just installed through PEAR. I did confirm that the path to pear is /opt/local/bin/pear, but I have no idea where it dumped the package files, so I don't know ho...
Hello, I have a problem with the jquery $.get function. I'm trying to get data from PHP file needed to check does the specific user has subscription and is he recorded at ignore list by other users. With this jquery code I can get only one of this two data from MySql using PHP file. The jquery code is: $(document).ready(function(){ ...
I have a contact form on a page that sends the details of the form to an email address. You can view it here, www.wonder.ie The HTML for the form is the following: <form id="form" name="form27" class="wufoo page" enctype="multipart/form-data" method="post" action="mailer.php"> <ul> <li id="foli1"> <label clas...
How can I convert a COleDateTime::GetCurrentTime() to a unix time stamp or more specifically I want to convert the value so I can use it in PHP with the date() function? ...