1. B

    How to delete two first lines in txt using PHP

    For example I have data: File generated by system automatically... 9 rows selected. Heber,Camrynborough,26728,Home Health Aide Modesto,West Janet,15152-2683,Software Engineer Dante,East Chanel,74689-6886,Entertainment Attendant Nolan,Murphyville,32561-8079,Credit Authorizer...
  2. B

    Conflict in routing between Laravel Nova and Dingo API

    I have a Laravel API server which only has one web route (test page), everything else is controlled via dingo/api package and all is working correctly. In config/api.php I've set 'prefix' => env('API_PREFIX', '/') as it's only an API server. I've since installed Laravel Nova and kept getting...
  3. D

    How to access json from Rest API

    I am returning data from a rest API. I was getting the header along with the json, but as Justin T. pointed out below I needed to add this to my cURL: curl_setopt( $ch, CURLOPT_HEADER, 0); That got rid of the header. Now I am having issue with the returned json and the encoding of it(I think)...
  4. C

    Replace array value to increment

    I have an array like this ... [0,0,23,0,0,18,0,0] Then I want to change values that are not '0' (23 & 18) to auto increment, so the end result will be like this, [0,0,1,0,0,2,0,0] is there the best way for all that? So far this is what I did, but the results were not as expected ... :)...
  5. H

    Best way to parse json_decoded php array

    What would be the best way to parse stringified one dimensional array? input array $inputArray = array( "id" => "foo", "name" => "bar", "money[0][amount]" => 30, "money[0][countryCode]" => "US", "money[1][amount]" => 25, "money[1][countryCode]" => "CA", ) desired output array...
  6. P

    PHP operators in an IF…ElseIf…Else statement. Jumping to Else?

    I am trying to use the IF...ElseIf...Else statement which includes basic Logical and Comparison operators. When running the code, instead of looping trough the if statement it echos the else statement only. I followed w3schools ( and...
  7. B

    How to retrieve values from a multi-d array in PHP?

    Here is an array from an user generated course-creation system. What would be the best way to retrieve values associated with [titreSection], [lessonTitle] and [lessonContent] keys ? Main goal here is to allow the user to create sections that contains a title with several lessons and content...
  8. N

    How to display php array

    This code will print result like this: So how can I separate the result in 2 variable like email[0],email[1]??? $TEST='i192a'; $stid = oci_parse($conn, 'select email from BNS_NOTIFY_RECIPIENT where screen =:num0'); oci_bind_by_name($stid...
  9. P

    PHP Regex - how to remove string after “Newline * regards”

    I've got strings like the following: Hi X Blah Kind regards ABC And Hi X Blah Regards CBA So the key is the newline and the word "regards" (case insensitive). I'd like to use PHP to get the part of the string before the line that contains "regards". E.g. for these examples, the result...
  10. E

    Parse Date in PHP

    I need some help parsing a date in PHP to a date object. I thought this was 8601 format, but $date = DateTime::createFromFormat(DateTime::ISO8601, "2018-11-14T01:11:36.059Z") is not working. Date Format is: 2018-11-14T01:11:36.059Z
  11. J

    How to get total of 2 arrays

    How do I get the total of 2 arrays. $array1 = [176, 0]; $array2 = [0, 160]; $combinedArrays = $array1 + $array2; // Actual result [176, 0] // Desired result [176, 160]
  12. R

    Equivalent of iframe on server side

    Is there any way to create an "iframe-like" on server side ? The fact is, I need to acceed to certains page of my society's intranet from our website's administration part. I already have a SQL link to the database that works fine, but here I would access to the pages without duplicating the...
  13. L

    Change product status if prices are updated in Woocommerce 3

    I need to change product post_status in a hook. I trying to make product get back to "pending" status everytime vendor change the price. add_action( 'updated_post_meta', 'mp_sync_on_product_save', 10, 4 ); function mp_sync_on_product_save( $meta_id, $post_id, $meta_key, $meta_value ) { if (...
  14. S

    Avoid fatal error on update_checkout event when Calculating Shipping in WooCommerce

    I want to calculate shipping when update_checkout triggered. i used below code in my plugin function function action_woocommerce_checkout_update_order_review($array, $int) { WC()->cart->calculate_shipping(); return; } add_action('woocommerce_checkout_update_order_review'...
  15. O

    Avoid cart items price update for specific product categories in Woocommerce

    I am using below script under my WordPress child theme functions.php to overwrite price, but below code is affecting to all the products. Can you please help me "not to run" below code if the product is under some specific "shirts", "games" category? function calculate_cart_total( $cart_object...
  16. M

    Getting the wrong timezone when outputting user registration date in Wordpress

    I'm trying to output user registration time in the local timezone, but Wordpress stores the user_registeredvalue in UTC format. Backend settings are set to be +2h. The following code: $user_registered = $user_info->user_registered; will display the UTC time like 2018-10-25 15:04:45, where I...
  17. B

    Show content on button click then hide that button

    I am using Wordpress and I have an Iframe game that I want to prevent this game from running until the button (play game) is clicked. So I want to create a div area (something like a button) when it is clicked the game will display, and that div area disappear. Here is the code that I use...
  18. B

    How do i redirect a php login file back to index.html presented with a message 'Welcome User'

    My work codes but the message is not showing up after clicking login. It does redirect for 5 second but does not show the appropriate message 'Welcome User' $error = ""; $success = ""; // username: user password: pass if (isset($_POST["submit"])) { $username = $_POST['username']...
  19. V

    Multi-user login trouble, also looking for good content on this topic

    so i'm having trouble and i really have no idea why i'm having this issue because all looks well. But basically i'm trying create multiple user levels for a web page i'm making. For some reason only the regular user role is working at the moment. Basically I want admins to be led to a different...
  20. M

    Add last update time in minutes counter in site

    I want to add a "counter" in my site of the last update time. This means that they see a counter of: "Last update: 12 minutes ago." So it displays the minute of the last update ago. It doesnt have to be real update time, if I can reset the timer when I want its good. Thanks for helping me out!