PHP

PHP
2 years ago

preg_match: /usersname or /username/foo

PHP
I'm wanting to preg_match the following URIs. Note usernames are: [\w]{1,15} /username /username/foo /usersname/bar I want these to fail /username...
2 years ago

Getting percantages of numbers. PHP array

PHP
there is dmgs array. $dmgs array: Array ( [0] => 5.1k [1] => 3.8k [2] => 12.9k [3] => 10.4k [4] => 4.1k [5] => 8.0k [6] => 7.6...
2 years ago

Get State and County from Address

PHP
I want to have the State and county from an Address using geocode with Google API. This is my code: $geocode=file_get_contents('http://maps.google.co...
2 years ago

YouTube v3 API upload to channel

PHP
I have to migrate my PHP scripts using YouTube's v2 API to v3. I'm trying this example to upload a video: https://developers.google.com/youtube/v3/c...
2 years ago

Why is my ternary expression not working?

PHP
I am trying to set a flag to show or hide a page element, but it always displays even when the expression is false. $canMerge = ($condition1 &...
2 years ago

compare dates in mysql where the day, month and year are stored separately

PHP
I would like to compare several entries, for which I have the day, month and year saved in separate variables. When I try the following, I do not get ...
2 years ago

Laravel 5.2, how to access users information from any route

PHP
I have manage to redirect users to a different views/parts of the site based on the users credentials, say the user want to see their profile, no prob...
2 years ago

Slim Framework v3 - Problems with PUT routes

PHP
Since I have upgraded to Slim v3 all my GET and POST routes are working well, but the PUT routes are not. I have a class where I do something like thi...
2 years ago

mySQL update query on join

PHP
I have a countries database and another table called zones. Countries [id, name, status (1 enabled 0 disabled) ] Zones [id, name, country_id] ...
2 years ago

AJAX returning an error

PHP
I'm trying to populate my dropdown using ajax but it returns an error. Here is my js code <script type="text/javascript"> $(document).read...
2 years ago

Importing to my sql

PHP
I am just learning php/mysql and can't add a new row to a database and i don't know why! <?php $Darrell= $_POST['Darrell']; $Ashley = $_POST['Ash...
2 years ago

Why not show class css in email when using mail() php send mail to gmail?

PHP
Why not show class css in email when using mail() php send mail to gmail ? I test send email by this code to hotmail it's show like this in email ...
2 years ago

php - characters instead of html

PHP
why the below code does not echos html content: $url = 'http://clashofclans.com'; echo file_get_contents($url); It works in all websites except $ur...
2 years ago

How to apply rand() or some other built-in function on an array that contains all string elements in order to randomly select a string?

PHP
I've a following array : $family = array("Amit", "Suresh", "Vinit", "Somesh", "Sagar", "Shriram"); Now I want to randomly select a name from the ab...
2 years ago

How to echo the information depending on what day it is? PHP

PHP
I am very new to php and I am trying to get out the info on one particular day. So if it is monday I will echo "its monday" and I have started with a ...
2 years ago

I have one form and my label is not in the same line of text area

PHP
<tr> <td valign="top" width="25%" class="contact-form" id="require">Or please give us a description of your requirements (Max:1...
2 years ago

Doctrine MongoDB find by id

PHP
I'm using odm mongo doctrine and I have to document-classes class Thing { /** * @MongoDB\Id */ protected $id; /** * @MongoDB\ReferenceOne(targe...
2 years ago

Get entire BODY content using PHP DOM DOCUMENT

PHP
I want to get entire body tag content using DOM Document. I used following code: $dom = new domDocument; /*** load the html into the object ***/ $...
2 years ago

HTACCESS: Dynamic rewrite url with multiple variables

PHP
I've been working on this for a couple of days now and I'm wondering if anyone could point me in the right direction please... I'm trying to pass two ...
2 years ago