Eliminating null value nested array php

I have an array and contents nested inside the original array. The contents of the array look like- $myArray [0] => Array( [ID] => 1 [Fruit] => Apple [State] => Ohio [description] Array( [0] => This is sample description ...
more »

2017-07-18 14:07 (1) Answers

Merging 3 arrays in PHP

I have 3 arrays as below. $array1 = Array ( [0] => 05/01 [1] => 05/02 ) $array2 =Array ( [0] => ED [1] => P ) $array3 =Array ( [0] => Mon [1] => Tue ) I want to merge these 3 arrays as below $result_arr...
more »

2017-07-18 13:07 (6) Answers

Dynamic MySQL Query with PHP

Hi guys as the title states I'm looking for a way to make dynamic queries to my MySQL server. At the moment this is the code I use to update data on the server: $deskAttr = json_decode($_POST["desk_attributes"]); foreach($deskAttr as $key => $va...
more »

2017-07-18 11:07 (1) Answers

When chinese word in mysql where statement

how to select 主页报修上广告 $sql = "SELECT text,pic FROM newstable where type='在线报修上广告' order by id desc limit 0,1"; but you may find the return value is null But i try to use this $sql = "SELECT ...
more »

2017-07-18 09:07 (1) Answers

PHP Session variable reset

I have done a script of PHP that let the page decide if show a notification or not. The problem is that overtime the script work, the variable change and everything is fine, but when I reload the page, the session var return to his default, and reall...
more »

2017-07-18 03:07 (0) Answers

How to deal with help properties in form types?

I've created an property (foo) in my form type. This property has the goal to pass a value from buildForm() method (where it's initialized and on PRE_SUBMIT listener where it's modified) to the $view->vars in buildView(). This's a sample what I'...
more »

2017-07-17 17:07 (1) Answers

How to show json result array without js code

I have a script to consult an external API and retrieve data. What I want to do, is show an array with the result only, without the js and HTML code. I think is possible, but I don´t know how to do it. Please, I´m from Argentina. Sometimes is very...
more »

2017-07-17 17:07 (2) Answers

Add one array to a multidimensional array

I want to add the values of array b to array a: $a = [[1, 2],[4, 5],[7, 8]]; $b = [3, 6, 9]; Result should be: $result = [[1, 2, 3],[4, 5, 6],[7, 8, 9]]; I am trying this (and lots of other stuff) but don't get it. Thanx a lot!! forea...
more »

2017-07-17 16:07 (4) Answers

Why does 1...1 evaluate to 10.1?

I've just faced a little PHP snippet from 3v4l: https://3v4l.org/jmrZB echo 1...1; //10.1 And I'm afraid I have no idea how to explain its results. Why is this considered valid at all? ...
more »

2017-07-17 10:07 (4) Answers

ZF3 Development Mode VS Production Mode

I use ZF3 and code in the development mode. I configured it like the tutorial suggests: composer development-enable So everything works fine if this mode is enabled. If I disable it I get a database connection error, like this one: Connect Err...
more »

2017-07-17 10:07 (2) Answers

get meta tags is not working in php

I am trying to get meta tags of a website. Here is my code $tags = get_meta_tags('https://www.wired.com/story/avengers-infinity-war-d23-footage'); print_r($tags); exit; this returns empty. Any idea? Wesbite is using some compression like gz...
more »

2017-07-17 07:07 (1) Answers

How to get an array instead of json object?

<?php $link = mysql_connect('localhost', 'root', 'admin') or die('There was a problem connecting to the database.'); mysql_select_db('hospitalmaster'); $hnum = (int)$_POST["hnum"]; $sql = "SELECT d.doctorid, d.doctorname from hospitalm...
more »

2017-07-16 18:07 (1) Answers

What is the preg_match concept at use here?

The following is in a legacy php app, could someone please explain what is happening here, or what the general terminology is behind the line so I can research it. Mostly I am confused concerning ? $foo : !$foo preg_match("/^test_item_([0-9]*)/", $f...
more »

2017-07-16 16:07 (2) Answers

What is better? Using 'base_url()' or './'?

I have been using CodeIgniter Framework for some months. In views, I usually include external css and js with base_url(), just like this: <link href="<?php echo base_url() ?>assets/css/custom.css" rel="stylesheet"> But someone tells ...
more »

2017-07-16 12:07 (4) Answers

Internal Server Error in codeigniter on live host

I have deployed a website that uses CodeIgniter in the main public_html folder (http://www.myexample.com). This project working perfectly on localhost. In order to remove index.php from URL this has the following .htaccess: RewriteEngine on RewriteC...
more »

2017-07-16 08:07 (2) Answers