Parsing XML and TXT files in PHP

PHP
I have a Text.xml file with some text and the bibliographic references in this text. Its look like this: Text.xml <p>…blabla S.King (1987). Bl...
2 years ago

Anonymous classes in PHP 7

PHP
Where can i use and should i use anonymous classes that are presented in PHP 7 ? I can't find a use case for them. $message = (new class() implements...
2 years ago

Shorten long numbers to K/M/B?

PHP
I've googled this a lot but i can't find any helpful functions based on my queries. What i want is: 100 -> 100 1000 -> 1,000 142840 -> 142,...
2 years ago

Hiding HTML around Custom Field if empty with PHP

PHP
I'm trying to hide all the html if my custom fields are empty in Wordpress I'm using this: <?php if (the_field( 'attribute_1' ) & the_field( ...
2 years ago

check if value exists update else insert laravel

PHP
I have a function where what i want to do first check order_id exists it update else insert. Please suggest me public function possstContract(){ ...
2 years ago

how to get descending order of id's

PHP
i am fetching some records from a table in desc order with query- SELECT trn_id,cus_name,mobile,product,product_slno,entry_by FROM insur_trn WHERE...
2 years ago

Find array difference

PHP
I seem to be having bit of a mind blank here, I have 2 arrays: $network_keys= array( (int) 0 => '7 ADELAIDE', (int) 1 => '7TWO ADELAI...
2 years ago

Magento Observer is not firing

PHP
I'm trying to fire an observer whenever a product is updated in the admin cp. To log the updates. Config.xml <?xml version="1.0"?> <config&...
2 years ago

How to make rows to column names in an associative array in PHP

PHP
I want to convert rows to column names in associative array in PHP. My data is stored in a single variable $salesone in an associative array format. ...
2 years ago

Return only unique values from foreach

PHP
I'm currently trying to use a foreach to return all the addresses using the relation from my event model. All is fine, returns all the addresses but w...
2 years ago

WooCommerce - group downloads by product

PHP
In Woocommerce(*My Account page) I can see now an unordered list with all the downloads available, like: <ul class="digital-downloads"> <l...
2 years ago

How to display database value inside select tag using PHP and MySQL

PHP
I need one help .I can not display some db values inside select tag using PHP and MySQL.I am explaining my code below. <?php while($row=mysql_...
2 years ago

How to encode fetched data from MySQL to JSON via PHP

PHP
I'm trying to encode data coming from Mysql database into JSON format via PHP.Here's the code segment: try { $statement = $db->prepare($query)...
2 years ago

Two forms for a sql query

PHP
I'm having the following code. If I submit the first form (the one with the A and B options) the second query works fine, but when I submit the secon...
2 years ago

Detect the end of a result set in php/mysql

PHP
How do you detect the last record in a result set when using php and mysql. In ASP its EOF (End of File). Whats the php/mysql equivalent? I'd like to ...
2 years ago

get specific piece of a string

PHP
I have sql statements as string; a = "insert into table1 values('value1','value2','value3')" b = "insert into table2 values('value4','value5','value6...
2 years ago

Strict Standards: Only variables should be passed by reference in functions.php

PHP
I'm a bit confused by the error I am getting. The error is: Strict Standards: Only variables should be passed by reference in functions.php ...
2 years ago

Use Simple HTML DOM Parser to JSON?

PHP
I'm trying to group each of the elements of a scraped website, convert it into a json element but it doesn't seem to be working. <?php // Includ...
2 years ago

Preg match array keys

PHP
I have it like this: $data = array( "City_0" => "London", "City_1" => "Paris", "City_2" => "Lisbon", "City_3" => "Berlin"...
2 years ago

How to send an email using PHP?

PHP
I am using PHP on a website and I want to add emailing functionality. I have WAMPSERVER installed. How do I send an email using PHP?
2 years ago