How to append latest output result to text file without repeating output again and again

I want to get job status output with latest executed time to the text file , however when I run the job each time ( schedule using cronjob ) It’s appending old, executed result also in the text file as well, but I want to get text output with latest executed result only . How… Read More How to append latest output result to text file without repeating output again and again

Difference between using echo with one greater than sign and two greater than signs

I am reading the Kafka documentation. In step 6 of 1.3, there’s the following code: > echo foo> test.txt > echo bar>> test.txt I would like to ask what is the difference between using one greater than sign and two greater than signs. Thanks. >Solution : the former recreate the file on each invocation the… Read More Difference between using echo with one greater than sign and two greater than signs

Echo specific value of a key of an array generated from an XML

I have the following code: $myXMLData = "<?xml version=’1.0′ encoding=’UTF-8′?> <note> <RESPONSE xmlns=’http://www.ibm.com/maximo&#8217; xmlns:xsi=’http://www.w3.org/2001/XMLSchema-instance&#8217; creationDateTime=’2022-09-22T09:51:01+02:00′ transLanguage=’EN’ baseLanguage=’EN’ messageID=’993921663833062257153′ maximoVersion=’7 6 20180718-1141 V7610-83′ rsStart=’0′ rsTotal=’1′ rsCount=’1′> <CHANGE> <TEST> <CHANGEBY>TESTUSER</CHANGEBY> <CHANGEDATE>2022-09-21T17:42:21+01:00</CHANGEDATE> <CIA_DONE>YES</CIA_DONE> </TEST> </CHANGE> </RESPONSE> </note>"; $xml=simplexml_load_string($myXMLData) or die("Error: Cannot create object"); $array = json_decode(json_encode((array)$xml), TRUE); print_r($array); That returns the following result: Array ( [RESPONSE] => Array… Read More Echo specific value of a key of an array generated from an XML

How to get the name of each array as you loop through an array of arrays php

I have an array of arrays as so: $bookPages = array( "page-1-name" => array( "page_title" => "Search results", "page_name" => "search" ) , "page-2-name" => array( "page_title" => "Front Cover | HCDP", "page_name" => "cover" ) ) I am looping through to get the content each array like the "page_title" using a foreach. foreach (… Read More How to get the name of each array as you loop through an array of arrays php